Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to create a condition on a workflow transition based on the value of a custom field

Andrew Crawley September 3, 2021

We have a custom field called Current Environment which has a predetermined list of values. I'd like to create a workflow condition that allows the issue to be transitioned if that field is empty. Is this possible?

2 answers

0 votes
Oliver Siebenmarck _Polymetis Apps_
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.
September 6, 2021

Hi @Andrew Crawley ,

As @Mikael Sandberg suggested, the easiest option will be to use a workflow app that includes custom conditions. In my biased opinion Cloud Workflows is a great option, as it supports Jira Expressions as workflow conditions. There are, of course, other apps available.

Still, no matter what app you pick, you'll most likely end up building a condition based on Jira Expressions, so here's what things are going to look like. Let's say your custom field Current Environment has the id 12345, you could use an expression like this to make sure it's not set to Staging or Development:

issue.customfield_12345 != "Staging" && issue.customfield_12345 != "Development"

Jira Expressions are a fantastic way to build both, conditions and validators, and I cannot recommend them enough, even though they do take a bit of getting used to. 

Hope that helps,
 Oliver

Full disclosure: I work for the vendor who created Cloud Workflows. Let me know if you need any help getting started with this or Jira Expressions in general.

0 votes
Mikael Sandberg
Community Champion
September 3, 2021

Hi @Andrew Crawley,

Welcome to Atlassian Community!

Yes, this is possible.  You can use the Value field condition to check if the field in question is empty.

Andrew Crawley September 3, 2021

@Mikael Sandberg Oh ok I don't see the custom field listed in the dropdown of fields when creating the condition using the Value Field Condition. Do I need to change a setting or configuration in order to get it to appear in the list?

Mikael Sandberg
Community Champion
September 3, 2021

My bad, I was looking at the validator instead of the conditions. The value field condition only works for system fields, so you would need an app like JSU Automation Suite for Jira Workflows or Scriptrunner in order to do it. I have used both in the past and they are both really good apps.

Mikael Sandberg
Community Champion
September 3, 2021

Another solution if you do not want to use an app would be to use automation and either set a label or component, you could then check if one of these fields have the value that would allow the transition. Another option is to use a hidden number custom field that is set by automation and use the compare number custom field condition.

Like # people like this
Andrew Crawley September 3, 2021

@Mikael Sandberg ok I think that might a good workaround. I'll give that a try. Thank you!

Like Mikael Sandberg likes this
Andrew Crawley September 3, 2021

@Mikael Sandberg unfortunately I don't think we can use that solution with our workflow although it was creative and might be useful with other conditions. We want to be able to set the Current Environment field to Staging or Development and if those values are set, then the issue should not be able to be transitioned to Ready for Production. The issue that I am running into with your solution is that when using the automation to edit the Labels field, it is actually overwriting any existing values that are there. At this point, I think it would be easier to adjust our process and update our documentation to use the Labels field to indicate the environment for issues rather than the Current Environment custom field. Thank you for the help!

Mikael Sandberg
Community Champion
September 3, 2021

Did you use the add/remove value option on the Labels in Automation? If you click the three dot menu you should see that option:

Screen Shot 2021-09-03 at 4.08.54 PM.png

But yes, this is a workaround and you may run into situations where it may fail, so updating the process is probably the easiest.

Like # people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events