Forums

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

Don't send notifications when issue is updated by scriptrunner function

Dar Kronenblum
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2018

Hi,

I'm using script listener to update custom field based on some calculation 

Once the field value is updated all the issue watchers are getting notification on the change (based on our notification scheme) 

is there a way to prevent those notifications? 

can I add some function to the script the says 'don't notify watchers'?

thanks

Dar

 

1 answer

0 votes
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2018

Hello @Dar Kronenblum

How you update custom field?

You need update issue with IssueManager with dispatch option DO_NOT_DISPATCH and parameter sendmails false.

Here is example:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issueManager = ComponentAccessor.getIssueManager()
issueManager.updateIssue(user, event.issue, EventDispatchOption.DO_NOT_DISPATCH, false)
Dar Kronenblum
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2018

Hi @Mark Markov

I'm using this function to update the custom field

IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
cf.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(cf), val), changeHolder);

 

if I understand correctly, in your example no event will be fired, so there will be no indication in the issue history and no listener will be run, is it true? 

thanks

Dar

Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2018

There will be info in issue history, but no event and no notification.

More info about ways to update issue in Jira with code example you can find here
https://community.atlassian.com/t5/Agile-articles/Three-ways-to-update-an-issue-in-Jira-Java-Api/ba-p/736585

Dar Kronenblum
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2018

Hi Mark,

thanks a lot!

Apparently the agile board data such as time tracking fields doesn't get updated unless you put 'true' in the send email parameter :(

so I guess the notifications are necessary 

 

thanks anyway

Dar

Suggest an answer

Log in or Sign up to answer