How to abort a workflow transition in Plone
The recommended way is to set a guard instead.
The guard expression should be able to look up a view to facilitate more complex guard code, but when a guard returns False the transition isn't even listed as available.
I am working on a complex validation in a dexterity content type which should check the dependencies across several fields at the workflow transition time - I want it to work in the SimplePublicationWorkflow being triggered when the content is sent from "private" to "pending".
I've registered an event listener for IBeforeEvent and hooked it up - but nothing done there short of raising an exception can stop the transition from happening. (and if you raise an exception there, it goes uncaught and the user sees an error page instead of a custom message).
So, what is the recommended way to validate a transition in modern Plone? I've came across documentation suggesting adding External methods to be called on the Guard expression of the transition - but I would not like to use external methods, and if possible, I'd like to keep the default workflow. Creating a custom one is an option provided a clean way to do the check.