Make external comment mandatory during a transition.
This article provides the code snippet that forces the user to add an external/public comment on the transition screen while executing a transition.
Instructions
Navigate to the intended workflow to make the necessary changes in the edit mode.
Select the required transition.
Select the Validators tab and click
Add validator
.Add the “Scripted (Groovy) Validator (JMWE app)” validator.
Add one of the below Groovy scripts based on your use case:
Use case 1: The comment is mandatory on the transition screen, and it has to be external:!!transientVars.comment && (transientVars.commentProperty[0].contains("value: {internal: \"false\"}"))
Use case 2: The comment is not mandatory on the transition, but if entered then it has to be external:!transientVars.comment || (transientVars.commentProperty[0].contains("value: {internal: \"false\"}"))