We have a field that isn’t authorable, but must be set for urls to work (forced to replicate WordPress url behavior).
because of Tracing InvalidItemStateException the workflow doesn’t always succeed in populating the “legacyWordpressUrl” field/property of the document. When this happens, I want to prevent publishing the document (like throw an exception) instead of permitting publish which will cause broken urls.
If I put a “non-empty” hipposysedit:validators on the field, I am unable to save the document, so that doesn’t work.
If I have a workflow handler, and attempt to throw an exception on the event wfEvent.exception(new Throwable("field not set") then the event throws a log message that publish is already sealed and it publishes anyway.
Perhaps another solution could be adding your own custom action/task and inject it in scxml registry:
<if cond="(!requestPending or user=='workflowuser') and master and modified">
<!-- if unpublished is a master version and no request pending OR invoked by the 'workflowuser'
user (scheduled workflow jobs daemon): enable request publication operation -->
<hippo:action action="requestPublication" enabledExpr="true"/>
<if cond="workflowContext.isGranted(unpublished, 'hippo:editor')">
<!-- if (also) editor user (granted hippo:editor): enable publish operation -->
<hippo:action yourCustomWorkflowAction/>
<hippo:action action="publish" enabledExpr="workflowContext.feedback['customBooleanYouSet']""/>
</if>
</if>
You could follow the example of pre-existing isModified action at: /hippo:configuration/hippo:modules/scxmlregistry/hippo:moduleconfig/hipposcxml:definitions/documentworkflow/isModified
(Not sure if that’s the perfect place to place your custom action though)
Although it could be a good idea to avoid customizing workflow unless you really have to