Search code examples
acumatica

Adding custom field to Add SO Line dialog box in Invoices


I have created a custom field called HS Code in Stock Items (Screen ID IN202500) and managed to display it at line level on Sales Orders (Screen ID - SO301000) by customizing its attribute as shown below.

public class SOLineExt : PXCacheExtension<PX.Objects.SO.SOLine>
{
    #region UsrHSCode
    [PXDBString(50)]
    [PXUIField(DisplayName = "HS Code", Visible = true, Enabled = false)]
    [PXFormula(typeof(Selector<SOLine.inventoryID, InventoryItemExt.usrHSCode>))]

    public virtual string UsrHSCode { get; set; }
    public abstract class usrHSCode : PX.Data.BQL.BqlString.Field<usrHSCode> { }
    #endregion
}

How would I go about adding the same field to Add SO Line dialog box on Invoices (Screen ID SO303000)?

How can I referenced the custom field correctly on Add SO Line dialog box on Invoices screen?


Solution

  • You would need to extend the SOLineForDirectInvoice DAC. Now this DAC is a projection and not an actual table as such all you have to do is extend the DAC itself. When declaring the field make use of the BqlField property on the type attribute this will instruct acumatica from where to read the value for the field Eg:

    #region UsrHSCode
    [PXDBString(50, BqlField = typeof(SOLineExt.usrHSCode))]
    [PXUIField(DisplayName = "HS Code", Visible = true, Enabled = false)]
    public virtual string UsrHSCode { get; set; }
    public abstract class usrHSCode : PX.Data.BQL.BqlString.Field<usrHSCode> { }
    #endregion
    

    Once this is defined in the DAC extension you will be able to add it to the Add SO Line dialog which can be found under the dialog section of the layout editorenter image description here

    Once published the new field should be visible in the Add SO Line dialog.