Solved

Need advice: Which event should I use to run validations when the SO is being saved?

  • 14 February 2024
  • 2 replies
  • 30 views

Userlevel 6
Badge +3

I have a new project which is always great!  The customer wants to run a bunch of validations on a Sales Order when it is being saved.  None of the validations will prevent the saving of an invoice.  The result of the validations will simply set some values in some User Defined Fields on the Sales Order.

Since I am not doing validations that will produce any exceptions, I am not sure where in the process I would run these validations (i.e., in a method, override an action or process etc.).

I can dig into the Acumatica code but before I start that process, I would love a recommendation as to the best approach to do this.  FYI, I cannot debug the Acumatica code as I cannot seem to get my breakpoints to hit.  I added the bin folder to the symbols to load in the debug options, but it still doesn’t work.  That’s another topic, but since I cannot get debugging to work on Acumatica pdb’s, it is hard to determine where I should inject my code.  I haven’t been able to get debugging of Acumatica code to work for about the last year.  I’ve scoured the web but none of the suggestions work. Very frustrating.

Perhaps I should override the Save action (if I can)?  Or maybe there is a virtual method I can override with a delegate that is the “save method” for a SO?

 

icon

Best answer by Dmitrii Naumov 14 February 2024, 19:24

View original

2 replies

Userlevel 7
Badge +5

Hi @Joe Schmucker 

I’d say if your code depends only on one record, e.g. Sales Order header, you put it in the RowPersisting of the record, e.g. SOOrder_RowPersisting.

If you need more complex validations, e.g. compare values of different details with header totals, you do it in Persist method override.

Userlevel 6
Badge +3

Thanks @Dmitrii Naumov.  I was just playing with overriding the Save button, but I get an object reference error.  So I think I’ll try it in the RowPersisting.  I’ve never tried overriding the Save button, so I don’t have any previous code to copy/paste from.  :-)

Thank you for the quick reply!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved