I'm adding a new DAC/Graph that will drive purchases, and I want to route through the Create Purchase Order processing screen to keep it consistent with Acumatica ERP. I am leveraging INReplenishmentMaint to create the INItemPlan record, but I need a usrField to capture my source reference number (similar to a SO Order #).
After the INItemPlan record is saved, I update the INItemPlanExt.usrField to capture my source record via:
planExt.UsrField = myData.myKeyField;
graphRepl.Caches[typeof(INItemPlanExt)].Update(planExt);
graphRepl.Caches[typeof(INItemPlanExt)].Persist(PXDBOperation.Update);
However, if I have not created the purchase order yet, I can't update myData with the PO reference. Therefore, I need to update an existing INItemPlan record if it exists when clicking my "Create PO" button in my custom graph but keep creating a new INItemPlan record instead.
My dilemma is that the connection to myData is in INItemPlanExt, which I can lookup from my INItemPlan row, but I need to lookup in reverse... that is, I need to find my INItemPlan from the value stored in my usrField on the Ext DAC.
How do I get back to the base DAC from the Ext DAC? Or am I just going about this wrong? (If so, please tell me how I should go about processing myData row(s) into a PO to be consistent with Acumatica ERP.) I'm using 2018R1.