Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How an issue transition can update all sub-task in the same status ?

Hi everyone,

I have an issue with some sub-task and I want to synchronise the status between issue and sub-task.

In fact I want that when an user change the status on an issue this is change the status of alls sub-task.

 

I want to add a ScriptRunner postfunction to all transitions of the issue workflow that update the status in all sub-task of the current issue.

Does anyone can help me ?

 

1 answer

1 accepted

0 votes
Answer accepted

Hi,

You would be able to do that with the help of "Script Listeners" from your ScriptRunner plugin.

So add a new script custom listener, refine down the projects you want it for (or select for All the projects). 
Then select the Event which is triggered when your workflow status is changed.

That is, you need to figure out what Event is being fired in post-functioning of a transitioning. (Usually Issue Updated Event is set up, if not you could also test it with "All Issue Events")

The following script would transition all subtasks to the same status as their parent.

def subTaskObjects = issue.getSubTaskObjects()

def subTaskStatus
def currentSubTask

if (subTaskObjects){
def parentStatus = issue.getStatus()
for (int i=0; i<subTaskObjects.size(); i++){
subTaskStatus = subTaskObjects[i].getStatus()
currentSubTask = subTaskObjects[i]

if (subTaskStatus != parentStatus){
currentSubTask.setStatus(parentStatus)
currentSubTask.store()
}
}
}

Hello,

Thanks for your answer but sorry it doesn't work and I'm a newbbie.

When I use your script I have an error (issue not define) so I must add the line "def issue = event.issue" at the top of your script.

But I have another error and a warning...

At the line : currentSubTask.setStatus(parentStatus)

"Cannot find matching method"

At the line : currentSubTask.store()

"Use the Object's Service or Manager to save value. Since v5.0."

We use Jira v7.1.2 and ScriptRunner v5.0.14.

Thanks for your help.

Stéphane

It would work.
Just create a custom listener and make it run on all events for test purpose. 
then add the code in "inline script area'. 
(issue is a keyword that would be resolved on the issue level)

Do the above, and transition the parent issue to another status, all it;s sub-tasks would also get transistioned.

Yes I have saved it and despite the error and alert reported it works.

Thanks you so much.

Hi, sorry it's been so long, but how do i implement this? 
Where can I find the menu to put the script?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

183 views 2 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you