This code snippet checks the visibility of the comment added on the transition screen
Access the entity property which indicates the visibility of the comment.
import groovy.json.JsonParserType import groovy.json.JsonSlurper def commentProperties = transientVars["commentProperty"] as String[] def isInternalComment = false if (commentProperties) { def commentProperty = commentProperties.first() def props = new JsonSlurper().setType(JsonParserType.LAX).parseText(commentProperty) isInternalComment = props.find { it.key == "sd.public.comment" }?.get("value")?.get("internal") } return isInternalComment.toBoolean() |
NA
The output of this code is a boolean value that can be used to control the execution of a post-function or a validator. For example,
Send an email to a specific user only when an internal comment is added
Block the user from adding unrestricted comments on a specific transition