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?
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
But yes, this is a workaround and you may run into situations where it may fail, so updating the process is probably the easiest.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.