IssueService: Update Issue without sending notification mails

Dear Community,

Im about to write a groovy script (JIRA Scriptrunner), its an escalation service which updates a list of issues. I dont want to send any notification mails when updating these issues and here is my code:

def update = issueService.validateUpdate(user, issue.id, issueInputParameters)
if (update.isValid()) {
    issueService.update(user, update, EventDispatchOption.DO_NOT_DISPATCH, false)
}

according to the java api docs jira shouldnt send any mails when passing “false” as the last parameter. Furthermore, I pass the Service to not dispatch an event, but when the script is executed JIRA sends for every issue some notification mails. Can anyone please tell me what I need to change to avoid the system to send emails when updating issues?

IssueService Java-API Docs:
https://docs.atlassian.com/software/jira/docs/api/7.2.1/com/atlassian/jira/bc/issue/IssueService.html

So long

What sort of emails are being sent?

The Script deletes all comments, therefore a notification mail will be sent to the current assignee. The Email contains the issue with the note that a comment was deleted, I wonder why, because I tell the IssueService explicit not to send any mails…

Try to use IssueManager to update issue or CommentManager.

https://docs.atlassian.com/software/jira/docs/api/7.2.1/com/atlassian/jira/issue/IssueManager.html
https://docs.atlassian.com/software/jira/docs/api/7.2.1/com/atlassian/jira/issue/comments/CommentManager.html#deleteCommentsForIssue-com.atlassian.jira.issue.Issue-

I already use the CommentManager to delete comments:

for(Comment comment : comments){
		commentManager.delete(comment, false, user);
}

Documentation of the CommentManager:

dispatchEvent - if true then an event of type EventType.ISSUE_COMMENT_DELETED_ID will be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched. Together with IssueEvent CommentDeletedEvent

I pass false to not trigger the Event. I also replaced the IssueService with the IssueManager:

issue.setSummary(newSummary)
issue.setDescription(newDesc)

issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)

Still not working. When running the script, a few hundred mails will be sended. I wonder if any Atlassian employee can answer this simple question…I created this topic almost 2 weeks ago.

the idea is to update an issue by yourself through issueService where you can control sending e-mail (the last param == false)

and then pass an empty issueInputParametrs to the execution pipeline.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.event.type.EventDispatchOption

IssueService issueService = ComponentAccessor.getIssueService()
def user = currentUser

def cf =ComponentAccessor.getCustomFieldManager().getCustomFieldObjects(issue).find {it.name == 'xxxx'}


issueInputParameters.addCustomFieldValue(cf.id, "Hello, world!")
issueInputParameters.setSkipLicenceCheck(true)
issueInputParameters.setSkipScreenCheck(true)
issueInputParameters.setApplyDefaultValuesWhenParameterNotProvided(true)

def update = issueService.validateUpdate(user, issue.id, issueInputParameters)
if (update.isValid()) {
  issueService.update(user, update, EventDispatchOption.DO_NOT_DISPATCH, false)
}

issueInputParameters = issueService.newIssueInputParameters()