Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

[ScriptRunner] update a sub-task(s) Assignee to X value if parent customField 'x' value updated


I need help creating a listener in ScriptRunner to update a sub-task(s) Assignee to 'X' value if parent customField 'x' value updated to a certain option. 



If Parent field 'Module' which is a select list changes to: UI

Then (Signoff) "which is a Subtask issue type" assignee should change to: 'Jane Doe'


Thanks a lot

1 answer

0 votes
Kevin Johnson
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 04, 2020 • edited

Hi @Nour Durra , Just saw your request yesterday, worked on it and it was possible. It was a bit tough, so it was interesting. Hope this would help..!

Create a custom listener like shown in the image.l1.PNG

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue

def issue = event.getIssue() as MutableIssue

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObject("customfield_10488")
def cFieldValue = issue.getCustomFieldValue(cField)

String userName
case "Q1": userName = "kevin.e";break;
case "Q2 ": userName = "angelinjebapriya";break;
case "Q3": userName = "kevin.e";break;
case "Q4": userName = "angelinjebapriya";break;
case "Sales Team": userName = "kevin.e";break;
default: userName = null;

UserManager userManager = ComponentAccessor.getUserManager()
IssueManager issueManager = ComponentAccessor.getIssueManager()
ApplicationUser assignToUser = userManager.getUserByName(userName)

// Get a list of the current issue's subtasks
def subtasks = issue.getSubTaskObjects()

// Loop through all the subtasks and delete them

if(cField) {
def changeHolder = new DefaultIssueChangeHolder()
def i = it as MutableIssue

//update same custom field value in subtasks
cField.updateValue(null, it, new ModifiedValue(issue.getCustomFieldValue(cField), cFieldValue),changeHolder)
//set assignee as desired
issueManager.updateIssue(assignToUser, i, EventDispatchOption.DO_NOT_DISPATCH, false)




Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events