not change assignee in task in groovy script Edited

Hi everyone.  We have a script what  create a subtask, but doesn't works a change of assignee in parent's task.However we  see in the history that a assignee was changed. Could you please to help us to find decision of this problem.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder

def customFieldManager = ComponentAccessor.customFieldManager
def localizationField = customFieldManager.getCustomFieldObjectByName("Localization")
def config = localizationField.getRelevantConfig(issue)
def options = ComponentAccessor.getOptionsManager().getOptions(config)

def changeHolder = new DefaultIssueChangeHolder()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def issueService = ComponentAccessor.getIssueService()
def subTaskManager = ComponentAccessor.getSubTaskManager()
def constantManager = ComponentAccessor.getConstantsManager()
def issueManager = ComponentAccessor.getIssueManager()

def createValidationResult = issueService.validateSubTaskCreate(currentUser, issue.getId(), issueInputParameters)
if (createValidationResult.isValid()) {
def createResult = issueService.create(currentUser, createValidationResult)
if (createResult.isValid()) {
subTaskManager.createSubTaskIssueLink(issue, createResult.getIssue(), user)
issueInputParameters = issueService.newIssueInputParameters()
.setComment("Sub-tasks were created")
def updateValidationResult = issueService.validateUpdate(currentUser, issue.getId(), issueInputParameters)
if (updateValidationResult.isValid()) {
issueService.update(currentUser, updateValidationResult)



1 answer

0 votes
Micky Caritte Community Champion Nov 30, 2017

Hi alex,

Usually when I had this kind of issue in the past it was linked with reindexing issue after update.

Would you try to use the following class:

That should be something like:

IssueIndexingService iis = (IssueIndexingService) ComponentAccessor.getComponent(IssueIndexingService.class);

 Let me know if it works!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

418 views 7 5
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you