Validation on onPublish of document

Hello, I need to add a validation on document on click of “publish”(not on save).
I am trying to implement it through documentworkflow(scxml). I am able to add VlidationAction class but not able to show specific error messages on document.
Can you please provide some details on this?

I am trying to implement below approach.

“One way is through the use of a Workflow, which is a series of steps that content goes through before it is published. Workflows can be configured to include validation steps that check the content for compliance with specific standards or guidelines, such as branding guidelines, legal requirements, or accessibility standards.”

Thanks

I believe when you save the validation is called by the editor plugin, which can display validation messages because it is a UI plugin. When you change the scxml you aren’t in a place that is part of the ui. You’d have to change the behavior of the publish button on the menu.

Hello Jasper,

Thank you for the clarification, Can you please share some details on how can I have the same feature to add a validator class which is right now only for save button to be available for Publish as well? Because that has proper validation feature.

Thanks

Hello Yod,

I would challenge the approach you have taken as it sounds quite complicated. What kind of validation are you trying to achieve on the document?

Because in order to publish, your document has to go through the save/done process when the normal validation procedure takes place and you can inject your custom validation as described here.

HTH