I am looking to restrict field values based on another filed values?
Like I have single select fields called "Instance" and values Dev, Production,
and I have one more select field called "Number" values 1, 2, 3 ,4 5, 6 ,7 ,8 9
When I select "Dev" value in Instance I need to see only 1, 3, 5 values in number filed.
If I select production I need to see all values in Number field.
Can this done by without plugin?
Hi @suren
Unfortunately I don't believe there's a way to restrict the field values, even with an add-on. (Behaviours has the "Manage field options" action available in DC/Server, but not Cloud.)
I think the best you could do is add a Description to the Fields telling what values are valid for the Instance type, and then create a Custom Validator for your Workflow that doesn't allow users to submit if it doesn't match your requirements.
This will require purchase of an add-on (see link below):
The Custom Validator (aka Build-your-own (scripted) Validator) would need to be written using Jira Expressions and would look something like this (assuming 'Instance' field is customfield_12345 and 'Number' field is is customfield_23456):
(issue.customfield_12345.value == "Dev" && ['1','3','5'].includes(issue.customfield_23456.value)) ||
(issue.customfield_12345.value == "Prod" && ['2','4','6'].includes(issue.customfield_23456.value))
So for the Number field (on my test server I just used my generic "Single Select Field", you could edit the Field Description to say something like:
The add-ons allow you to put up an error-message if the expression evaluates as false, so you could then put a more explicit message:
You can add even more explicit instructions via the read-only "Message Custom Field", which would look something like this:
Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!
Help us plant more trees
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.