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

This widget could not be displayed.

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.

This widget could not be displayed.

Hi Cole,

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

This widget could not be displayed.

What do you mean?

This widget could not be displayed.

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

This widget could not be displayed.

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.

This widget could not be displayed.

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

This widget could not be displayed.

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 Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 8 hours ago in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

21 views 0 0
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