Search code examples
acumaticaacumatica-kb

Copying the value from a custom field to TaxRegistrationID field in RowPersisting event


I'm trying to copy the value from a custom field called "customerExt.UsrRfc" to TaxRegistrationID field but it doesn't work in Customers screen, I'm using Customer_RowPersisting event handler.

This is the customerExt.UsrRfc field: enter image description here

This is the TaxRegistrationID field: enter image description here

This is the RowPersisting event:

protected void Customer_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
{
  Customer row = (Customer)e.Row;

  if (row == null)
  {
      return;
  }

  var customerExt = row.GetExtension<BAccountExt>();

  row.TaxRegistrationID = customerExt.UsrRfc;
}

I tried to copy the value to another field like "Account Ref #" and it works fine.

Can you help me with this?


Solution

  • The TaxRegistrationID field in the screenshot is from Location DAC instead of Customer: enter image description here

    You need to change the solution to update the field in the correct view.