Skip to main content
Solved

Add field of Inventoryitem to Sales Order Line

  • November 12, 2024
  • 5 replies
  • 131 views

idrusm52
Jr Varsity III
Forum|alt.badge.img

Dear Support,

I have created usrLookup (Part No) field on Inventoryitem and I want this field to add on column Sales Order Line.

Please advise.

 

Thanks,
Idrus

Best answer by Nilkanth Dipak

Hi @idrusm52,

To add your custom field(Part No) from the InventoryItem table to the Sales Order Line grid in Acumatica, follow these steps:

1. Extend the SOLine DAC: Create an extension for the SOLine DAC (Data Access Class) to add a field that pulls in the value from InventoryItem.UsrLookup.

2. Link the Field Using BQL: In the DAC extension, define the new field with a BQL query to retrieve the UsrLookup value based on the inventory item selected in the sales order line:


   [PXFormula(typeof(Selector<SOLine.inventoryID, InventoryItemExt.usrLookup>))]
   

3.Add the Field to the SOLine Grid: Finally, use the Customization Editor to add the field to the Sales Order Line grid on the Sales Order screen (SO301000).

If you need to use attributes from the Inventory Item screen, This  link will help you achieve that.
 

Hope, it helps!

View original
Did this topic help you find an answer to your question?

5 replies

Nilkanth Dipak
Semi-Pro I
Forum|alt.badge.img+10
  • Semi-Pro I
  • 406 replies
  • Answer
  • November 12, 2024

Hi @idrusm52,

To add your custom field(Part No) from the InventoryItem table to the Sales Order Line grid in Acumatica, follow these steps:

1. Extend the SOLine DAC: Create an extension for the SOLine DAC (Data Access Class) to add a field that pulls in the value from InventoryItem.UsrLookup.

2. Link the Field Using BQL: In the DAC extension, define the new field with a BQL query to retrieve the UsrLookup value based on the inventory item selected in the sales order line:


   [PXFormula(typeof(Selector<SOLine.inventoryID, InventoryItemExt.usrLookup>))]
   

3.Add the Field to the SOLine Grid: Finally, use the Customization Editor to add the field to the Sales Order Line grid on the Sales Order screen (SO301000).

If you need to use attributes from the Inventory Item screen, This  link will help you achieve that.
 

Hope, it helps!


idrusm52
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 30 replies
  • November 12, 2024

Hi @Dipak Nilkanth,

Thanks, can you please add the screenshot so I can follow the steps easily.

 

Thanks,
Idrus


Nilkanth Dipak
Semi-Pro I
Forum|alt.badge.img+10

Hi @idrusm52,

I have not implemented this solution, so I do not have any screenshots to provide.

I am simply offering a suggested approach to achieve this functionality.

 


idrusm52
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 30 replies
  • November 13, 2024

Hi @Dipak Nilkanth,

I just paste your step into ChatGPT and got information as below and it’s working fine. Thanks.

 

To accomplish these tasks, follow the steps below to extend the SOLine Data Access Class (DAC) and add a custom field that retrieves a value from the InventoryItem table. Here’s how to set it up:

1. Extend the SOLine DAC

Create a DAC extension for SOLine to add a new field that pulls in the UsrLookup value from InventoryItem.

  1. In the Customization Project within Acumatica, open the Code Editor and create a new DAC extension class.

  2. Define the extension class for SOLine and add a new field, UsrLookup, to retrieve the value from the InventoryItem table.

    Copy code

    using PX.Data; using PX.Objects.SO; using PX.Objects.IN; namespace CustomizationNamespace { public class SOLineExt : PXCacheExtension<SOLine> { #region UsrLookup [PXString] [PXUIField(DisplayName = "Lookup Value")] [PXFormula(typeof(Selector<SOLine.inventoryID, InventoryItemExt.usrLookup>))] public virtual string UsrLookup { get; set; } public abstract class usrLookup : PX.Data.BQL.BqlString.Field<usrLookup> { } #endregion } }

    • PXString defines the type of the UsrLookup field. Adjust the type according to the actual field type of UsrLookup in InventoryItem.
    • PXFormula with Selector pulls the UsrLookup value from InventoryItem based on the selected inventoryID in the SOLine.

2. Link the Field Using BQL

The [PXFormula(typeof(Selector<SOLine.inventoryID, InventoryItemExt.usrLookup>))] attribute defines a formula that automatically retrieves the UsrLookup value from the InventoryItem table. Here’s how it works:

  • Selector: This BQL selector links SOLine.inventoryID to the usrLookup field in InventoryItem, using the InventoryItemExt DAC extension where UsrLookup is defined.
  • This formula will update the UsrLookup field on the sales order line whenever the inventoryID changes.

3. Add the Field to the SOLine Grid on the Sales Order Screen (SO301000)

To display this field on the Sales Order Line grid in SO301000:

  1. Open the Customization Project Editor.

  2. Navigate to the Sales Order Screen (SO301000).

  3. Select the SOLine grid.

  4. Add the UsrLookup field to the grid by locating it under the Fields section of the Customization Editor.

  5. Drag it into the desired position within the grid layout.

  6. Save, publish, and test the customization to ensure the UsrLookup field displays correctly and pulls the value from InventoryItem based on the selected inventoryID.

This setup allows the UsrLookup field to be displayed and populated dynamically on the Sales Order Line grid in SO301000 based on the inventory item selected in the sales order.

 

 


Nilkanth Dipak
Semi-Pro I
Forum|alt.badge.img+10

@idrusm52 Thank you for the sharing the solution with the community.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings