Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Field Required Validator / Either or

Anette Noll
Contributor
April 11, 2024

Hi all,

after trying a lot with Field Required Validator with optional validation I hope to find the answer here.

Following scenario:

  • Create Screen
  • In case field A and B are empty 
  • field A or B must not be empty

 

Thank you for help!

 

3 answers

3 accepted

1 vote
Answer accepted
Suprija Sirikonda _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2024

Hi @Anette Noll,

Your requirement can be achieved using the Jira Misc Workflow Extensions (JMWE) app. 

Solution:

  1. On the creation transition, add the "Build-your-own (scripted) Validator" from JMWE.
  2. Add the below Jira expression: 
!!issue.customfield_10081 || !!issue.customfield_10004

Replace 10081 and 10004 with the IDs of fields A and B from your instance. The above expression returns false if both A and B are empty. It returns true in all other cases.

Try the above in your instance. If that doesn't work, let me know the types of the two fields so I can tweak the above script for those field types.

BTW, I'm from Appfire, the vendor of JMWE app. If you've any questions on this, feel free to create a ticket with our support team here.

Regards,

Suprija | Appfire

Anette Noll
Contributor
April 11, 2024

Thank you so much, @Suprija Sirikonda _Appfire_ . 

It works.

 

Like • Suprija Sirikonda _Appfire_ likes this
0 votes
Answer accepted
Maciej Dudziak _Forgappify_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2024

Hi @Anette Noll

It should be pretty simple in any jira expression-based validator. If either field A or B must be not empty:

issue.customfield_10004 != null || issue.customfield_10005 != null

 Change ID to correct ones for your Jira instance.

I am from Forgappify, and we developed Jira Expression Validator, which is part of the Workflow Building Blocks for Jira free app. In the expression editor, when you start typing the name of your field, you will get a suggestion for the ID.

For some types of fields you, expression maybe slightly different, e.g. for array types you may need to use:

!!issue.customfield_10004?.length 

I hope it will help.

Cheers

 

0 votes
Answer accepted
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 11, 2024

Hi @Anette Noll , with the OOTB Field Required Validator, if there are two fields involved it will always be an AND operation. There is not an OR validator natively. If you want to allow a transition if either field A OR B is not empty then you need an addon app.

Anette Noll
Contributor
April 11, 2024

Hi @Jack Brickey 

thank you for reponse.

Probably you mean JMWE app?

I already use it

Jira 1.PNG

No, chance to describe it in the optional validation?

Or are you speaking of another addon app?

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 11, 2024

Hi @Anette Noll , good to know that you have JMWE. I believe you can achieve with JMWE but I do not have sufficient personal experience with it. However, let me see if I can assist with a bit of Community searching. I encourage you to do the same ... two heads better than one 😉

Like • Anette Noll likes this
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 11, 2024

From my brief research you will need to build your own scripted validator. Other than the documentation link just provided there are examples of similar scenarios. One such example is below. 

JMWE-plugin-multiple-choice-custom-field-validator 

In my experience, the appfire team, and other community members are quite helpful with JNWE scripts. Hopefully one such individual will jump in here with an exact answer.

in the meantime, if you figure it out, please do post the exact script that you used as it will help others in the future.

Anette Noll
Contributor
April 11, 2024

Thank you very much for your support, @Jack Brickey .

In this short span of time my problem has already been solved.

 

 

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, ace, atlassian community event, donation, girls who code, women in tech, malala fund, plan international, kudos, community badge, badge, atlassian badge, International Women’s month, International Women’s Day, women's month, women's day

10 for Change at Atlassian Community Events

Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!

Join an Atlassian Community Event!
AUG Leaders

Upcoming Jira Events