Skip to main content
Example scripts
arrow icon
To homepage
Jira
Cloud icon
Cloud

Add automated comment for every issue created inside a Jira Service Management Customer Portal.

Created 1 year ago, Updated 1 day(s) ago
App in script
ScriptRunner For Jira
ScriptRunner For Jira
by Adaptavist
Compatibility
compatibility bullet
Jira
Language |
groovy
def comment = """
                Hi, ${issue.fields.reporter.displayName} from ${issue.fields.customfield_12818.value} office,

                Thank you for creating this ticket in our service desk. You have requested a laptop replacement delivered to following destination:

                ${issue.fields.customfield_12831}

                Please make sure the address is correct. We will respond to your request shortly.

                Kindly also note if the ticket remains inactive for a period of 10 days then will automatically be closed.
            """

def addComment = post("/rest/servicedeskapi/request/${issue.key}/comment")
        .header('Content-Type', 'application/json')
        .body([
                body: comment,
                // Make comment visible in the customer portal
                public: true,
        ])
        .asObject(Map)

assert addComment.status >= 200 && addComment.status <= 300
Having an issue with this script?
Report it here