Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Groovy snippet to get the comment visibility

Abstract

This code snippet checks the visibility of the comment added on the transition screen

Logic

Access the entity property which indicates the visibility of the comment.

Snippet

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()

Placeholders

NA

Examples

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

References