Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

RE-assigning a jira service desk issue to another group, clearing the assignee Edited

In our Jira Service Desk project - we are using a script (see below) - to detect a "group assignee" change - When this occurs - we clear out the assignee (since the assignee may/many not be in the new group)   This all works fine - the issue?   The issue is not cleared from the queue of the original assignee - it worked several months back - did not realize it changed - have not upgraded Jira - just several Add-Ons ...   no errrors - the script works fine. 

I do see where I am getting a warning about this line below: //need this to update in database

Use the object's Service or Manager to save values

I'm suspecting that the warning is my issue .. not sure what to change it to. 

The full script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.issue.IssueEventBundle

//import com.onresolve.scriptrunner.runner.util.UserMessageUtil
import com.atlassian.jira.issue.MutableIssue;

MutableIssue issueToUpdate = (MutableIssue) event.issue;

//def currentIssue = event.issue;
//def customFieldManager = ComponentAccessor.getCustomFieldManager();
//def groupField = customFieldManager.getCustomFieldObjectByName('Assignee Group');

//def groupFieldValue = issueToUpdate.getCustomFieldValue(groupField);
//UserMessageUtil.success("groupFieldValue>>>" + groupFieldValue)
// UserMessageUtil.success("in ifff>>>" + issueToUpdate.assignee)

def change = event?.getChangeLog()?.getRelated("ChildChangeItem").find {it.field == "Assignee Group"}


//if (groupFieldValue != null && issueToUpdate.assignee != null) {
// UserMessageUtil.success("in ifff>>>" + issueToUpdate.assignee)
issueToUpdate.setAssignee(null); //need this to update in database
} //else {
// UserMessageUtil.success("in else>>>" + issueToUpdate.assignee)


1 answer

1 accepted

0 votes
Answer accepted
brbojorque Community Leader Dec 30, 2019

Hi @JDave ,

I think the store() method does not exist or it is already depreciated.

Here's the working code.

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

import com.atlassian.jira.issue.MutableIssue;

def issueManager = ComponentAccessor.getIssueManager();
def issue = (MutableIssue) event.issue;
def change = event?.getChangeLog()?.getRelated("ChildChangeItem").find {it.field == "Assignee Group"}

def currentUserObj = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
issueManager.updateIssue(currentUserObj, issue, EventDispatchOption.DO_NOT_DISPATCH, false)

initial testing - This worked - THANK YOU !!!!

Suggest an answer

Log in or Sign up to answer

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