Reputation: 1188
I had to create a DAC extension in Visual Studio project instead of the DAC class into customization because I had to define dropdown values for few fields and I cannot create it if I extend DAC directly from customization.
Here is the code for DAC extension with dropdown field and its values, from Visual Studio project-
public class SOOrderExtension : PXCacheExtension<PX.Objects.SO.SOOrder>
{
#region Class DropDownValue
public static class DropDownValue
{
public const string Value1 = "1";
public const string Value2 = "2";
public const string Value3 = "3";
}
#endregion
#region UsrDropDown
[PXDBString(1)]
[PXUIField(DisplayName = "My DropDown")]
[PXStringList(new string[]
{
DropDownValue.Value1, DropDownValue.Value2, DropDownValue.Value3
},
new string[]
{
"One", "Two", "Three"
})]
public virtual string UsrDropDown { get; set; }
public abstract class usrDropDown : IBqlField { }
#endregion
}
This is working fine and it has created new user defined fields into SOOrder existing table. However, if I add any new fields into this DAC extension class, it does not create new fields in SOOrder table and just skips when I publish my customization. Hence I need to add a SQL script to my customization to add those new fields into SOOrder table.
I am not sure if this is the correct way to do it. Ideally, it should create new fields into SOOrder table if I add new field in DAC extension in Visual Studio same as if I add new field in DAC extension directly into customization.
Upvotes: 0
Views: 369
Reputation: 6778
Krunal, Acumatica will only create new columns in database when you declare new bound DAC field in customization project manager. There is no way to automatically create new column in database when someone declares new field in DAC extension directly in Visual Studio.
Please refer to the screenshot below showing how to declare your custom UsrDropDown directly in project manager:
Upvotes: 1