I have two dropdown (select list - Single choice) fields "Internal Group" and "External Group" which I'd like to add on create screen. As per the project needs, users create tickets for field values of either of 'Internal Group' or 'External Group' field.
Options for fields:
Internal Group: A, B, C
External Group: 1, 2, 3
Let's say suppose I am creating a ticket for 'Internal Group' - A, I'd like to make 'Internal Group' as a required field and 'External Group' as an optional field and proceed with ticket creation.
Likewise, If I am creating a ticket for 'External Group' - 1, I'd like to make 'External Group' as required and 'Internal Group' as an optional field.
Can we in Jira add some logic so we can mark both fields as required and automatically make one of them optional based on value selected in other field?
Any groovy scripts to achieve this will also be of big help. Thanks!
Hi,
At a client of mine I have built a validator with JMWE Build-your-own validator on Jira DC. With the groovy script
issue.get("Field A") || issue.get("Field B")
Hi @Nikhil ,
Maybe you can use a Simple scripted validator of Scriptrunner.
And than maybe something like:
cfValues[‘Internal’] != null || cfValues[‘External’] != null
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nikhil
Try using Workflow PowerBox app (if you have Jira on-prem). It has feature called "Validator Templates". you can create a template with 2 validators (one per field) and connect them with "Any of fillowing validators" operator.
Should work:) and you can define your own validation error messages as well.
Unlike ScriptRunners behaviours (great plugin anyway) validators work also when using REST API.
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 script runner behaviors to achieve this. https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html
No need to write any scripts if you have already have the plugin
First bullet point in the documentation
Making a field mandatory depending on other data entered on the issue screen (i.e during an issue creation or an issue transition)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would probably use two different Issuetypes (Internal, External) and have different screen schemes for the two so you could have the appropriate field required.
Another consideration - use a cascading field:
and make the field required via the create transition validator.
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.