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,644,490
Community Members
 
Community Events
196
Community Groups

Scriptrunner Script Listener not working on Workflow Transition

I use an Scriptrunner Script Listener to create sub-tasks. My script condition is as follows:

def subtaskIssueTypes = issue.getSubTaskObjects().collect {it.getIssueType().getName()}
(cfValues['Purge Stock']?.getValue() == 'Yes') && (!('Purge Parts' in subtaskIssueTypes))

So the condition above should return TRUE when the Purge Stock custom field value equals "Yes" AND when there is NOT already a Purge Parts sub-task created.

The Script Listener event is set to Issue Create and Issue Update. The Script Listener does NOT work when I change the custom field value to "Yes" on a workflow transition screen. However, it DOES work when I set the value to "Yes" on the issue CREATE screen and when changing the custom field value to "Yes" from the VIEW screen.

Any ideas why the transition screen isn't working?

4 answers

0 votes
Leonard Chew
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.
Jul 11, 2019

@Alexey Matveev

I tried adding the Generic Event along with the Issue Update event. When I did this, it caused the two sub-tasks to be created instead of one. So the good news is that the Generic Event did cause the sub-task to create on issue transition. But the problem is that it seems that the Issue Create and Generic Event each created a sub-task. Strange.

0 votes
Alexey Matveev
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,

The problem is that when you change a field on a transition screen the Generic event fires by default. I guess, that is your case. Add Generic event to your listener.

Alexey Matveev
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 04, 2018

Have a look at the Create issue transition. What event do you throw there? Try to log the event name in the listener and have a look what happened.

log.error(ComponentAccessor.getEventTypeManager().getEventType(event.getEventTypeId()).getName())

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

This is happens because during the transition invokes event that specified in this transition and it seems it is not ISSUE_UPDATED event.

So the easy way to resolve this is - fire some custom event on transition and catch it with listener.

And the hard way learn more about event bundles.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events