Condition to hide transition based on custom field and issue type

Disclaimer: I'm not good with scripting, I've only done a few basic ones here and there. Please assume I don't even know basics!

I'm trying to use the "Hide Transition (JMWE add-on)" condition on a workflow transition, so that the transition isn't available when two conditions are met.

The issue type is "Task".
The custom field "Needs Review?" (12012) has the option "No" selected from a single-select list.

 

I've tried many methods I've found online, none quite exactly what I'm trying to do, and none working. This is the simplest form I've tried, so probably a good place to start.

def value = getCustomFieldValue("customfield_12012");
	
if (issue.get("issuetype").name == "Task"){
    if (value == "No"){
    return false;
}
}
	
return true;

 

Thank you!

1 answer

1 accepted

This widget could not be displayed.

Sounds like you're doing it the hard way.  You can nest conditions, so you can have one condition that checks the issue type, use the "and" boolean and a second condition that checks the custom field.  The "JIRA Suite Utilities" add-on provides a condition called "Value Field." You can use that condition to control both actions. See the screenshots for an example. You use the same settings, but choose the appropriate field and string for each condition.

Screen Shot 2017-04-11 at 4.08.26 PM.png

Hi Dave,

Thanks so much for your suggestion. I hadn't considered using add-ons as it's a bit of a hassle to get those approved, but I pushed this one through and the new condition worked out great.

Worth mentioning, we had to do a little extra complexity to eliminate a null condition. The final working result ended up like this.

Conditions.jpg

Thanks again!

Sweet! That add-on has a lot of great features, so I'm sure you'll find ways to use them as well.

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 yesterday 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...

64 views 1 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