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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,945 views 12 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot