---
title: "Groovy snippet to get the comment visibility"
canonical: "https://support.appfire.com/space/JMWE/462061873/Groovy%20snippet%20to%20get%20the%20comment%20visibility"
format: markdown
---
> Macro (aura-html)

### 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

- [Issue interface](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/78316748)
- **[Groovy Documentation](http://groovy.codehaus.org/User+Guide)**

### Related articles

> Macro (contentbylabel)