Transition Issue Groovy Script

Karie Kelly
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.
February 4, 2015

I was wanting to use the post function - Transition Issue - and have it based on if the groovy script were true.  

However, I'm not sure how to write the groovy script and I don't have the coding resources here to help and am hoping this forum could. 

I need a script that would evaluate if all four custom date fields are not null - that way, if they were all not null, it would return as true and it would transition; but, if at least one were null, it wouldn't transition. 

I located the field IDs that I'm interested by getting the ID from the URL when editing the custom field - I'm assuming that is ok.   

The IDs associated with the four fields are 14911, 14913, 14910, 14912

Could anyone be able to assist in providing a groovy script that could be used in this case for the transition issue post function.

1 answer

0 votes
Andrey Kuzmin
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.
February 9, 2015

What you really need is a transition validator.

For this purpose i recommend to use JIRA Suite Utilities plugin. Its free and it really is helpfull.

Just do a Field Required validator as described here for all 4 firelds on transition and you will be fine.

Karie Kelly
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.
February 9, 2015

Hi Andrey, I appreciate the suggestion. However, I cannot make them required because, in this use case, they are not required. But, I only want to transition IF those four fields are not null. If they are not, it won't transition. Basically, there are four approvers for a given state and they each have their own approval button that only they can see when it is in their queue. At any time, either can move it back to a prior state; but, it cannot move on to the next state until all four have approved. I've gotten around it by creating two different transitions: one that shows if the other three fields (other than the user's) are not completed and one that shows if all other three fields are completed. So, it works. But, I was hoping to keep the workflow simpler, if possible.

Suggest an answer

Log in or Sign up to answer