Script runner - Builtin Script Listener - Fast-track transition an issue
I am trying to set up a Builtin Script Listener to "fast-track transition an issue". I have read all the blogs I can find but nothing tells me how the listener is triggered or how to test it.
I am using...
Script runner Version: 2.1.12
I am using the Generic event and a condition to check the issue status and custom field value...
Event - "Generic Event"
Projects - "Project Name"
Condition - return ( issue.getStatusObject().getName()=="In Progress" && cfValues["zz6 - CPE email"]?.getValue() == "Yes" )
Action - "custom transition"
For the condition I have also tried
issue.getStatusObject().getName() == "In Progress" && "custom field" == "value"
I am using a default notification scheme.
There is no clear documentation on how the condition should be written i.e use of " or ' names of customfields or JIRA ID
Also using assert to test does not give an error even though something is clearly not working.
Any help / advise would be appreciated.
The listener is triggered if the event is triggered. So first make sure you test with the correct event (e.g. is the corresponding email from the notification scheme triggered?).
What kind of customfield is zz6 - CPE email? If it's a (single) select list your code should be ok.
Is the transition valid for the current state of the issue, check the ID.
And last but not least, add log messages (etc. log.error(cfValues["zz6 - CPE email"]?.getValue())) to the listener and check the log to get details (is it triggered, is the value of a variable like you expect, etc.
Thanks Henning. To answer your points.
In the post function of the transition that sets the issue to "In Progress" and sets the cust field value (of the select list), the last action is "Fire a Generic Event event that can be processed by the listeners."
There is no email linked to this event, just a notification to watchers and assignee.
- I do not know how to validate if this is working.
The transition is valid and can be run manually with no issue.
I consdered using a custom event, but could not get that to work either - do you think it is a problem of the notification scheme or Event set up?
do I need to add a line to reindex the issue?
In the meantime I will add log messages script to see if it captures any errors.
Check the logs - you can see how to up the log level here: https://jamieechlin.atlassian.net/wiki/display/GRV/getting%20help#GettingHelp-Supportrequests
This will show you the condition that's being evaluated and what it returned.
If you only want this to fire on In Progress, why don't you put it as a post-function on transitions to that state...
Are you transitioning to Resolved? If so you may need to set a resolution - if that's the problem the logs will tell you.
I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs