Hello,
I have the two following custom fields:
- CF1: checkbox (Values: "Yes", "No")
- CF2: URL Field
I would like to add a validator to the workflow as follows:
If CF1="Yes", then the field CF2 is mandatory to transit from state A to state B in the workflow.
Please is there any means to do this with Jira?
Kind regards
Hi @Yves MOUAFO
If you are open to using apps, consider using a Jira expression-based validator. There are several options available on the marketplace.
We've developed the Jira Expression Validator as part of the free Workflow Building Blocks for Jira app. The Jira expression for your case will be similar to the following:
issue.customfield_xxxxx.value == "Yes"
? issue.customfield_yyyyy != null
: true
You need to change the ID of the custom field to a valid one. In the editor, after 'issue.', start typing the name of the field, and you will get suggestions with the correct value.
I hope it will help.
Cheers
Thank you for your help. I have tried this solution but there is a mistake in the Jira expression. See the screenshot below
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Validation message must be a string, please surround it with ""
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.
Hi @Yves MOUAFO
Hope you're doing well! Our journey to simplifying Jira Expressions has brought us to the 'Ultimate Validator' (now in Beta). It lets you tap into most of the power of Jira Expressions—without writing a single line of code—through a simple UI. Just wanted to share this with you—hope you find it useful! Here’s how your case of a conditionally required field looks in the UI
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use Automation for Jira.
Trigger would be the transition of the issue. We would check if the status transfer is prohibited by your prerequisites. If so, we would restore the ticket to the original status.
So for this, you would need the history of the status field of the ticket to be able to get the original status back if the mandatory item for the transition is empty. Best to store it in a variable {{originalStatus}}
Checking both prerequisite related entries is possible using the conditional blocks.
However, your fields are custom fields. these have a somewhat different system name that should be used to address them in the conditional statements:
it would not be cf1 but cf[xyz]. where xyz is a 5 digit number.
You can look these up by using the field in an advanced search issue command and look at the syntax help that pops up while you write the field name. In each Jira instance these numbers are different, so you need to look them up in your instance.
The conditional line in the Jira Automation would look like:
if cf[12345] = 'yes' then...
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.