Skip to main content
Solved

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


Joe Schmucker
Captain II
Forum|alt.badge.img+2

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?

 

Best answer by Dmitrii Naumov

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.

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

2 replies

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • 629 replies
  • Answer
  • February 14, 2024

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.


Joe Schmucker
Captain II
Forum|alt.badge.img+2
  • Author
  • Captain II
  • 451 replies
  • February 14, 2024

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


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