Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to change transition of status based on custom field selected scriptrunner

Bongani Hermans July 21, 2019

I have a custom field created which is a drop-down :

Testing - Test fail 

               Test Pass approved

                Test Pass approve to UAT 

When the field select is changed the transition status should change e,g from in progress to done.

 

1 answer

0 votes
Ismael Jimoh
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.
July 21, 2019

Hi @Bongani Hermans 

I would suggest doing this the other way around.

There are no true events available for issue field values being updated hence, you will need to listen to the standard issue updated event. This is triggered for wuite a lot of events hence it can get resource intensive.

Instead if you transition the issue and it automatically sets a field, its a per issue event.

Hope this helps. 

Bongani Hermans July 21, 2019

Hi @Ismael Jimoh  

I need to fast track a transition based on custom filed value selected/changed, my problem is calling the custom field in scriptrunner console.

If users selected/edit an option in the custom field , I want the issue to transition directly to another status.

Ismael Jimoh
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.
July 21, 2019

In this case, I would rather do the following instead.

  1. Add the field to a screen.
  2. Associate this screen with a transition where users are required to fill this screen.
  3. Add a post-function to the same transition that checks the value of the field.
  4. If the value matches what you are interested in then perform your fast track transition.

Note from the above that you would need to order your post functions accordingly so that the fast-track transition comes last.

As mentioned, I am unaware of an event that checks for the change of a field other than the standard issue updated event, which if you use this would trigger quite frequently.

Your alternative if you want to use this would be as follows:

  1. Get issue updated event.
  2. Have your field and another hidden field that stores the last value of the field.
  3. Check the value of the field (if correct, proceed, else exit)
  4. Compare the value of your field and the hidden field (if equal, exit, else proceed)
  5. If different, add your transition script in here to perform the transition.

Do note that even though the above reduces the amount of load since your script would exit early, JIRA would still have to perform this check every time the issue updated event is triggered..

Bongani Hermans July 23, 2019

Hi @Ismael Jimoh 

That procedure did not work for my project, i added a plugin called automation and it does work accordingly.

Regards

Bongani

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events