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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,553,087
Community Members
 
Community Events
184
Community Groups

Scriptrunner Scrip Listener slower than Fast-Track Post Function = problem

@JamieA

I use a Script Listener to create a sub-task when a custom field value equals "Yes." I also use a Fast-Track Post Function to transition my workflow when:

issue.subTaskObjects.size() == 0

So essentially, I want to Fast-Track my workflow forward if there aren't any unresolved sub-tasks (Note: I recognized the condition above won't do what I need. I address that below.) . If I update the custom field value to "Yes" via a transition screen, I expect the Fast-Track to FAIL since a sub-task is created. However, this does not happen. I believe that what may be happening is that the Post Functions, including the Fast-Track, complete before the Script Listener determines I've updated the custom field to "Yes." So the sub-task is created AFTER the Fast-Track post function has completed.

The reason I think this is happening is because the Fast-Track is blocked, as I expect, when I complete the previously stated actions AND a sub-task already exists on the issue.

QUESTIONS:

  1. Am I correct in my assumption that the Post Functions might be completing before the Script Listener is taking action?
  2. The current condition I'm using above is not what I need. I really want to confirm that IF there are any sub-tasks open that they must all be resolved to allow the Fast-Track to complete. Can you guide me on how to create that script condition?

Thanks for your help.

1 answer

0 votes
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Aug 03, 2018

Hello @Gavin Minnis

I'm not Jamie, but

1. Yes, you are right. Script Listeners runs only when event happens and after all post-function.

2. 

issue.subTaskObjects?.every {it.resolution != null}

@Mark Markov

As usual, thanks for your quick responses. Ok I think I can overcome my problem by requiring the team to make changes with the edit screen instead of the transition screen. It’s not ideal, but I can probably make it work. It is strange though, because I would think that the same issue would occur when the field value is set on the Create screen. 

Regarding the other suggestion you gave about checking that sub-tasks are resolved, I’m not at a computer but will check and update soon. 

Take care. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events