It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is it possible to disabled notifications on issues modify by Adaptavist ScriptRunner for JIRA Cloud

Hello,

I use Adaptavist ScriptRunner for JIRA Cloud addons and it's awesome.

Problem i have... i need to add some script who modify issue fields but when i execute some script with it : all my user receive an notification : Change By : Adaptavist ScriptRunner for JIRA Cloud.

Is it possible to add on the script : DO NOT SEND notification with the update ?

Thanks a lot.

Regards.

Paul

2 comments

Go to ScriptRunner add on -> Settings -> there you can control the massages the script send, "Notifications Group" you can change it to no group, "Notify Assignee and Reporter" you can disable.

Hi :)

Theses settings is about when the script is failed :
"The group to which email notifications will be sent if a script fails to execute"
And
"Send notifications to the Assignee and Reporter of an issue if a script fails to execute"

My goal is to remove notifications for issues updated by the script.

Thanks for your answer but i think, it's impossible to remove system notifications by script...

You need to create a notification scheme that doesn't send any notifications. At the start of your script you need to change the project notification scheme to this new one (https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-project-projectIdOrKey-put). At the end of the script you can revert the change to the original one.

I was able to do it programmatically in ScriptRunner (without using Rest API):

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.notification.NotificationSchemeManager
import com.atlassian.jira.project.Project
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.user.util.UserManager
import org.apache.log4j.Level




log.setLevel(Level.DEBUG)

def projectManager = ComponentAccessor.getProjectManager()
def issueManager = ComponentAccessor.getIssueManager()
def commentManager = ComponentAccessor.getCommentManager()
def userManager = ComponentAccessor.getUserManager()
def notificationSchemeManager = ComponentAccessor.getNotificationSchemeManager()

// delete all comments for given issue in given project
def issue = issueManager.getIssueObject("issue_key")
def project = projectManager.getProjectObjByKey("project_key")
log.debug(project.getName())

def notificationScheme = notificationSchemeManager.getSchemeFor(project)

if (notificationScheme != null){
  log.debug(notificationScheme.getName())
  notificationSchemeManager.removeSchemesFromProject(project)
}

for(comment in commentManager.getComments(issue)){
  log.debug(comment.getBody())
  def user = comment.getAuthorApplicationUser()
log.debug(user.getName())
  commentManager.delete(comment, false, null)
}

if (notificationScheme != null){
  notificationSchemeManager.addSchemeToProject(project, notificationScheme)
}

 

Like siddhesh likes this

Comment

Log in or Sign up to comment
Community showcase
Published in Jira

Managing Incidents - The roof is on FIRE!

The roof is on FIRE… network outages, broken processes, upset clients and employees. Each day seemed to bring more and more issues. Incidents were communicated via email, messengers (skype or teams) ...

121 views 0 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you