Our new Appfire Documentation Space is now live!

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

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

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 transitioning without a Fix Version/s when the comment is internal

References

  • No labels