It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to make either of the two fields required on create transition?

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!

4 answers

0 votes
Jack Community Leader Aug 19, 2019

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:

  • Internal
    • A
    • B
    • C
  • External
    • 1
    • 2
    • 3

and make the field required via the create transition validator. 

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)

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.

Hi @Nikhil ,

Maybe you can use a Simple scripted validator of Scriptrunner.

And than maybe something like:

cfValues[‘Internal’] != null || cfValues[‘External’] != null 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

303 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you