Skip to main content
Solved

Can not save SOBillingAddress and SOBillingContact document data in 24.202.0026 during Sales Order Creation

  • November 22, 2024
  • 1 reply
  • 42 views

In version 24_202_0026 which was upgraded from version 23_107_0022 I attempt to programmatically create a SO document. The Bill Address and Bill Contact handling code works with issues. I had the PX.Data.PXLockViolationException error on PressSave().

 

SOBillingAddress billAddress = docgraph.Billing_Address.Current = docgraph.Billing_Address.Select();
billAddress.OverrideAddress = true;
billAddress = docgraph.Billing_Address.Update(billAddress);

docgraph.Actions.PressSave();

 

Here I have fond a potential solution.  

 SOBillingAddress billAddress = docgraph.Billing_Address.Current = docgraph.Billing_Address.Update(new SOBillingAddress { OverrideAddress = true });

 docgraph.Actions.PressSave();

 

Using the recommended code I get the PX.Data.PXOuterException: 'Error: Inserting  'Billing Address' record raised at least one error. Please review the errors error, also, on the end of process, I see the Error: 'RevisionID' cannot be empty.Address is not validated. error. The Save operation works fine when I assign a value to RevisionID field manually during the project debug.

 

As a solution, I tried to use the StackOverflow’s recommended way with Select instead of Update.

SOBillingAddress billAddress = docgraph.Billing_Address.Current = docgraph.Billing_Address.Select(new SOBillingAddress { OverrideAddress = true });

docgraph.Actions.PressSave();

But this is not the best way to select a value and save because in Select method we should add a field value and not a whole DAC or table.

 

The same history is with SOShippingAddress and SOShippingContact data. Similar topic is discussed here.

Is there a solution to satisfy the Acumatica’s native code?

Best answer by vachagan62

I have found the solution by using the View.SetValueExt logic.

docgraph.Billing_Address.SetValueExt<SOBillingAddress.overrideAddress>(docgraph.Billing_Address.Current, true);

After this, the Actions.PressSave() worked fine.

I hope this can be helpful for someone.

View original
Did this topic help you find an answer to your question?

1 reply

  • Author
  • Freshman III
  • 4 replies
  • Answer
  • November 22, 2024

I have found the solution by using the View.SetValueExt logic.

docgraph.Billing_Address.SetValueExt<SOBillingAddress.overrideAddress>(docgraph.Billing_Address.Current, true);

After this, the Actions.PressSave() worked fine.

I hope this can be helpful for someone.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings