How to fetch values from one dac to another screen?
Hello all,
I have a custom field, similar to stock item description in the stock items screen and I am looking to fetch the value from the custom field to my PO screen under the details tab. I have a new field added under the details tab & now want to display in this. How can I do that?
Thanks in advance.
Page 1 / 1
Hi @Harshita ,
You can use following code snippet to achieve the same.
protected void POLine_InventoryID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { var row = (POLine)e.Row; if (row == null) return;
// Fetch the custom field value from the InventoryItem InventoryItem inventoryItem = PXSelect<InventoryItem, Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>> .Select(Base, row.InventoryID);
Hope, it helps! FYI: This code works only when you updating the Inventory ID field from POLine.
Hi @Harshita ,
You can use following code snippet to achieve the same.
protected void POLine_InventoryID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { var row = (POLine)e.Row; if (row == null) return;
// Fetch the custom field value from the InventoryItem InventoryItem inventoryItem = PXSelect<InventoryItem, Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>> .Select(Base, row.InventoryID);
Hope, it helps! FYI: This code works only when you updating the Inventory ID field from POLine.
Hello @Dipak Nilkanth , thank you for your prompt response. It is throwing the below error:
Hi @Harshita ,
You are adding code to the DAC extension, this is not right. You can add custom fields to the DAC extension and not write an logic.
this code you need to add to the the graph. i.e. public class POOrderEntry_Extension : PXGraphExtension<POOrderEntry>
You need to extend POOrderEntry graph and add logic to transfer fields values from one screen to another.
public class POOrderEntry_Extension : PXGraphExtension<POOrderEntry> { protected void POLine_InventoryID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { var row = (POLine)e.Row; if (row == null) return;
// Fetch the custom field value from the InventoryItem InventoryItem inventoryItem = PXSelect<InventoryItem, Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>> .Select(Base, row.InventoryID);
You are adding code to the DAC extension, this is not right. You can add custom fields to the DAC extension and not write an logic.
this code you need to add to the the graph. i.e. public class POOrderEntry_Extension : PXGraphExtension<POOrderEntry>
You need to extend POOrderEntry graph and add logic to transfer fields values from one screen to another.
public class POOrderEntry_Extension : PXGraphExtension<POOrderEntry> { protected void POLine_InventoryID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { var row = (POLine)e.Row; if (row == null) return;
// Fetch the custom field value from the InventoryItem InventoryItem inventoryItem = PXSelect<InventoryItem, Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>> .Select(Base, row.InventoryID);