How to cancel record update with trigger beforeUpdate

Is it possible to cancel the record update in a workflow in beforeUpdate trigger?
I would expect it but it does not work.
There is no simple bool to archive that so i tried to use an expression to set the record to oldRecord. That does not make any difference at all.
But to use an ComposeUpdate is also not the right way - it creates a circle reference with beforeUpdate.

Do i really have to create a server script?
Help appreciated. Thx.

Hi. Use exception block in the place where you want to stop the update.

I tried that before and it didnt worked. But it seems that it was a problem with my workflow, which got saved but the “old” one got used. Maybe some local vars prevented the new one from gettin used.
Not able to reproduce that behavior, but i have seen this sometimes.
After your comment i tried again, reloaded the app - and it worked.

Thx. :wink:

1 Like

It seems that with version 2021.3.5 i cannot output a message anymore. I think that status = SessionFailed is the problem cause it is only set if st.errHandled isnt true. And it seems to me that its always true in my case.
I m gettin the workflow %d step %d execution failed: %w message but the workflow is not canceld.

I dont know what i have to hand over to the error trigger. Usually it was a string and than a message was spawned. That does not work anymore. (Not with whatever type or function, here example bool) workflow 233176708985913361 step 227 execution failed: false

Its not about the version. There is something wrong with the workflow editor.
Even if the workflow seems to be ok - and can be run it seems its possible that there are invisible steps left. So connections between steps are removed from the view but exist in “background”. I ll come back if i can reproduce it.

I have also noticed that. Also once I deleted an enabled workflow, and found that even if the workflow has been deleted it still fires until it is disabled from admin…