Skip to main content
Solved

Add Inventory Item Attribute to the Sales Order Line Items


I am wanting to get the value from an attribute for a inventory stock item. The attribute is showing under Attributes tab when editing the inventory item (IN202500). The type is text.

I am trying to make the value show on the Sales Order Line grid. I have added a data field usrBrand, and it is showing the column. My problem is that I can’t figure out how to make the brand value show in the Sales Order Line Items grid

 

2 replies

Userlevel 5
Badge +2

So, if you are not aware, all attribute values are stored in a table called CSAnswers.  Every entry has a RefNoteID that links to the object’s Noteid (your particular inventoryItem’s noteid) and an attribute ID that identifies the particular attribute type(Brand in your example above).  Here is an example bql query to get you started

 

var attributes = SelectFrom<SOLine>

                    .InnerJoin<InventoryItem>.On<SOLine.inventoryID.IsEqual<InventoryItem.inventoryID>>

                    .LeftJoin<CSAnswers>.On<CSAnswers.refNoteID.IsEqual<InventoryItem.noteID>

                        .And<CSAnswers.attributeID.IsEqual<CustomConstantwithAttributeName>>>

                   .Where<SOLine.OrderNbr.IsEqual<@P.AsString».and<soline.ordertype...
 

Badge +12

Additionally, you could possibly use a [PXDBScalar()] DAC attribute or else the FieldSelecting event for UsrBrand to set the value.

Reply