Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×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
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
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:
Is there a way to implement this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.