I noticed in Help that it is recommended that the Before Save event action on Application Builder not be used if updating/inserting to tables. I was curious if I could get more technical details on why that is recommended?
Spoke with Vy. The answer:
We probably can remove those lines from Help and let developers decide what they want to do with it.
The Before Save action is used to stop data getting saved/updated if there are any errors or warnings, so developers should be careful if they’re doing updates/inserts within the LB because those won’t be stopped by this action. Any updates/inserts hit within the LB won’t be rolled back if the LB returns a warning that pops up the dialog to the end user
Updated NW Help content to say:
This action stops data from being saved or updated if there are any errors or warnings.
If the associated logic block has any warning messages associated with the Before Save event or the Before Save event initiates a warning from the logic block, a dialogic box appears in the UI with the associated warning message(s).
If other actions in the logic block perform inserts or updates, this action does not stop them and changes are not rolled back if the logic block returns a warning.
To expand on what Kailey has said, there’s one important caveat to using Before Save event logic blocks. They only run from the UI. So if someone is creating or modifying a record in a table via an integration or another logic block, the Before Save event will not run.
So if you as a developer need to be sure that certain logic always runs on an insert, update, or delete this is not your tool. An Action Block or Trigger on the Table Definition is what you should use instead.
