Set assignee of a subtask as per the assignee of another subtask

Hi,

Our workflow creates 'Design' and 'Development' sub tasks. I set the development task assignee the same as the design task assignee in a post-function script for 'Design' task workflow.

def dsnAssignee = issue.getAssigneeId()
def subTasks = issue.getParentObject().getSubTaskObjects()


subTasks.each {

    if (it.issueType.name == "Development"){
        it.setAssigneeId(dsnAssignee)
     
        }
  }
This does not set the assignee of 'Development' task to the 'Design' task assignee. What else do I need to do in the above script?

Thanks

1 answer

1 vote
Vasiliy Zverev Community Champion Jan 26, 2016

Updating issue consist of two steps:

  1. Settiong new values (what you have done)
  2. Storing changes into database. Use this to do it

    ComponentAccessor.getIssueManager().updateIssue(ComponentAccessor.getJiraAuthenticationContext().getUser().getDirectoryUser(), issue, EventDispatchOption.ISSUE_UPDATED, false)

    The reason to do it: you make a lot of changes and store it to database at once.

if that does not work, try it.store().  You probably also want to reindex the issue. 

ComponentAccessor.getIssueIndexManager().reIndex(it);

Thanks a lot Vasilliy and Jeff. My issue is resolved.

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
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

103 views 0 2
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