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

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

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.

Hi Cole,

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

What do you mean?

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

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.

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

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

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,317 views 14 20
Join discussion

Atlassian User Groups

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!

Find my local user group

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

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot