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
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,218 views 5 10
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