Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Suppress notification when ScriptRunner updates custom field

Ryan Schamp
Contributor
October 12, 2022

We're using the following script (in a Listener) to update a custom field ("Last Comment") with the last comment on the issue. This is to make it searchable with jql and pull into reporting. It works, except it also sends an email out when it does the issue update. 

Is there a way to suppress that notification email?

 

The script:

final lastCommentFieldName = 'Last Comment'

// Get last comment custom field id
def customFields = get("/rest/api/2/field")
.asObject(List)
.body
.findAll { (it as Map).custom } as List<Map>
def lastCommentCfId = customFields.find { it.name == lastCommentFieldName }?.id

// Updates the issue with the created comment body
put("/rest/api/2/issue/${issue.key}")
.header("Content-Type", "application/json")
.body([
fields:[
(lastCommentCfId): comment.body
]
])
.asString()

1 answer

0 votes
Kristian Walker _Adaptavist_
Community Champion
October 14, 2022

Hi Ryan,

Thank you for your question.

I can confirm that when calling the Edit issue API to update an issue field you can not send a notification by setting the *notifyUsers * flag to false as mentioned in the Atlassian API docs located here.

This means you would simply add in the line below into your rest call after the .headers line to skip sending a notification.

.queryString("notifyUsers":false);

I hope this helps.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events