Skip to main content

Is it possible to make Acumatica load all data into a graph? In the code below I create a SOOrderEntry graph, find an existing sales order and set the current document to the sales order.

This sets the current document but it doesn’t load the sales order lines - as it would if I was using the UI. 
The value of sOOrderEntry.Transactions.Current is null. 

In the final 2 lines I set the  Transactions.Current value myself by selecting the first record returned from Select, but is there a way to make Acumatica load data into the SOLine view (and other views) automatically? (like the UI does)

public PXAction<INKitRegister> UpdateSalesOrder;
rPXUIField(DisplayName = "Update Sales Order")]
protected virtual IEnumerable updateSalesOrder(PXAdapter adapter)
{
SOOrderEntry sOOrderEntry = PXGraph.CreateInstance<SOOrderEntry>();
SOOrder sOOrder = sOOrderEntry.Select<SOOrder>().FirstOrDefault(x => x.OrderNbr == "SO000276");
sOOrderEntry.Document.Current = sOOrder;
SOLine sOLine = sOOrderEntry.Transactions.Current;

sOOrderEntry.Transactions.Current = sOOrderEntry.Transactions.Select().First();
sOLine = sOOrderEntry.Transactions.Current;
}

 

This is an assumption, but I believe much of the UI only loads data when it is requested. I believe this is what the LoadOnDemand property is on Tab Item. The difference would be that it is seamless in the UI and you never notice it happening.


Reply