I have created a new form tab screen(Project Sub Tasks) which consists of two tabs, Bill of Quantities and Sub Contractor quotes.
What I would like to achieve is, when I have added a new record to one of the tabs, to write it to the project’s cost budget it’s associated with.
I have tried the following code:
// 1. Create an instance of the BLC (graph)
ProjectEntry graph = PXGraph.CreateInstance<ProjectEntry>();
protected void _(Events.FieldUpdated<PMBillOfQuantity, PMBillOfQuantity.amount> e)
{
var row = (PMBillOfQuantity)e.Row;
// 2. Create an instance of the DAC, set key field values (besides the ones whose values are generated by the system),
// and insert the record into the cache
PMCostBudget CB = new PMCostBudget();
CB.AccountGroupID = 35;
CB = graph.CostBudget.Insert(CB);
// 3. Set non-key field values and update the record in the cache
CB.Amount = row.Amount;
CB.Description = row.Description;
CB = graph.CostBudget.Update(CB);
}
Any help would be greatly appreciated