Hello,
I want to make some changes to fields when the Parent Account field is updated on the CustomerMaint graph.
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/1dac2b37-0000-496f-b575-d06bcc1769e6.png)
public class CustomerMaint_Extension : PXGraphExtension<PX.Objects.AR.CustomerMaint>
{
protected virtual void _(Events.RowUpdated<Customer> e)
{
if (e == null) return;
Customer customer = e.Row;
if (e.Row.ParentBAccountID != e.OldRow.ParentBAccountID && e.Row.ParentBAccountID != null)
{
BAccount bAccount = Base.Select<BAccount>().FirstOrDefault(x => x.BAccountID == customer.ParentBAccountID);
//bAccount is returned when the parent BAccount is a customer
//bAccount is null when the parent BAccount is a supplier
//do things
}
}
}
I’ve created an extension and I’m using the code above to get the BAccount record of the selected Parent Account. Problem is, when the Parent Account is a supplier the BAccount is not returned, when the Parent Account is a customer to works.
If I add the following code, it worked for both suppliers and customers, but Acumatica doesn’t like graphs being created in events.
var g = new PXGraph();
BAccount bAccount3= g.Select<BAccount>().FirstOrDefault(x => x.BAccountID == customer.ParentBAccountID);
I assume that something in the CustomerMaint graph is filtering out suppliers but I’m not sure what.
Can anyone explain why this is happening and suggest a workaround?