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 vote
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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

75 views 0 5
Read article

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