Design Direction and Help with Method Directive to Stop a Save

I need to create a way to stop a record save and show an error.

Task: I need to stop an OrderDtl record from being saved if the PartNum is a specific part like PART_A and the DocDspUnitPrice is 0.00

Work So Far
If you update either of these fields, they fire a different Method under the SalesOrder BO. So, I’m thinking I’ll have to write the same BPM twice (once for each method)

So, I started with the method on Changing the UnitPrice.

Once in the BPM I check if the values that are being saved match the criteria and if so, throw an exception.

I did this in a pre-processing directive and the values coming into the “changed rows” in a condition node were the existing field values, not the new ones. So I could not seem to get it to compare to the incoming data. But I could make it throw the exception without issue.

I tried it in a base-processing directive and the values coming into the “changed rows” in a condition node were the new field values, so the comparison worked correctly. However, when I then fire the exception, it does stop the save from happening, but the error message does not show in the interface.

Questions:

  • Is the lack of error message in base-processing expected behavior?
  • Is there a better way to trigger this task since there are two entry points (changing part # or changing DocDspUnitPrice)

Try putting the bpm on the SalesOrder.Update, or the SalesOrder.UpdateMaster as a pre-processing… this is actually where the data is written.
but if that doesnt work, then you can also put it in as a data directive, and capture it there. This is not as good of a location, becuase it will be triggered every time the data is written, so you need to have good conditions (when field X changes from anything to anything) so that you only run the logic at the correct time.

1 Like

Thanks that worked. I did not realize those methods rolled up into MasterUpdate.