Wanted to add condition for validator

c-njain
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 28, 2020

Hi Team,

Wanted to add If else condition for validator in JIRA workflow.

Below is the requirement.

 

Change type is one of the field.

If change type value= XYZ

  then attachment should be mandatory

Else

 attachment should not be mandatory.

Kindly please let me know how to achieve this.

If its possible with script runner, then kindly share the test script as well.

 

Regards,

Neeta Jain

 

 

 

 

3 answers

0 votes
Phill Fox
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 28, 2020

Hi @c-njain 

Welcome to the community

 

As @Danyal Iqbal has already explained one solution is to have two different transitions to cover your scenario. As you are new to community I have taken the liberty of assuming that you may also be relatively new to Jira and Workflows so will provide a bit more information to help you. 

Transition 1. 

Condition  - change type value= XYZ

Validator - attachment is present

Transition Screen - must show the attachment field 

Transition 2. 

Condition  - change type value is not XYZ

Validator - none required

Transition Screen - may show the attachment field 

For simplicity I would use the same transition screen for each transition (it is less confusing this way)

As an end user I will only ever see one of the two transitions when viewing an issue as the two conditions are mutually exclusive. 

 

Hope this helps you solve your problem.

 

Phill

Deon Schaffer April 6, 2024

Hi @Phill Fox,

I have a variation of this that I would like to solve... I have a screen that is displayed on transition. On that screen I have a field for which I would like to base validators.

Scenario:
Transition from To Do to In Progress. Screen X is displayed with 3 fields: A (Yes/No), B and C. Depending on the value of Field A:

  • If A = Yes --> Fields B and C are required.
  • If A != Yes --> Fields B and C are not required.

Is there a way to implement this?

0 votes
Radhika Vijji _Innovalog_
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.
May 28, 2020

Hi,

If you have JMWE in your instance, you can use the "Field required validator (JMWE)" to implement this with a one-line conditional script (Jira expressions). Let me know if you have JMWE. I can help you with the configuration/scripting.

Regards,

Radhika

Dinesh Balakrishnan February 15, 2023

Can u help me with JMWE scripting. 

Bascailly, what I'm looking for his, during the Change Request creation, I want to validate the planned start date where it should be now+2 business days for few change types.

0 votes
Danyal Iqbal
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.
May 28, 2020

You should create two different transition for the two different use cases. One transition has a validator for attachments and the other has no validator for the attachment.

Writing a script to implement this is a bad idea.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events