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

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

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

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.

0 votes

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.

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())

@Alexey Matveev _cPrime_

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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Statuspage

New feature: Slack notifications for Statuspage

We're excited to announce the release of a long-requested feature on Statuspage. Now visitors to your status page can subscribe to get notified in Slack when you report an incident or maintenance. Th...

67 views 0 9
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