Trying to write a Groovy script for my workflow post function to change assignee

Cole
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.
August 25, 2016

It says "Only execute this post-function if the following Groovy expression returns true"

I am trying write a script to change the assignee based on what a user chooses in a custom field, but I am not having any luck. I figure my script is wrong and I cannot find any information to help my particular case. I had something like this:

if(issue.get("Issue Source").getName() == "Agent Portal"){
return true;
} else {
return false;
}

 

I got it to work doing this:

 

if(issue.get("customfield_18173")
== "Desktop" || issue.get("customfield_18173") ==
"Support"){
return true;
else {
return false;
}

 

However, I want this to happen on creation, so I put it on the Create transition (the first one), but it is not working.

7 answers

1 accepted

0 votes
Answer accepted
Cole
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.
August 25, 2016

I got it to work doing this:

 

if(issue.get("customfield_18173")
== "Desktop" || issue.get("customfield_18173") ==
"Support"){
return true;
else {
return false;
}

Also, make sure the post function is the first in the order.

0 votes
Cole
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.
August 25, 2016

I solved it by moving the post function to the first in the order. Thank you for your help!

0 votes
David _old account_
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.
August 25, 2016

Which post-function are you using? And where did you put the post-function in the list?

0 votes
Cole
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.
August 25, 2016

I got it to work doing this:

if(issue.get("customfield_18173")
== "Desktop" || issue.get("customfield_18173") ==
"Support"){
return true;
} else {
return false;
}

However, I want this to happen on creation, so I put it on the Create transition (the first one), but it is not working.

0 votes
Thanos Batagiannis _Adaptavist_
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.
August 25, 2016

Sorry, I I misread your question. Maybe this answer is of any help https://answers.atlassian.com/questions/272403 ?

0 votes
Cole
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.
August 25, 2016

What do you mean?

0 votes
Thanos Batagiannis _Adaptavist_
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.
August 25, 2016

Hi Cole,

I thing your tag and the title of your questions are inconsistent....

Suggest an answer

Log in or Sign up to answer