Conditional Validation on Transition

Deon Schaffer April 6, 2024

I have a transition on which I am trying to do "Condiitonal Validation".

I have a screen that is displayed on transition. On that screen I have a field for which I would like to base validation. 

In the transition from To Do to In Progress, Screen X is displayed with 3 fields:

  • A (Yes/No)
  • 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?

2 answers

1 accepted

1 vote
Answer accepted
Floating electron
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 9, 2024

Hi @Deon Schaffer

It would be possible to achieve using Jira Expression Validator, which is part of the free Workflow Building Blocks for Jira app.

The expression would be as follows:

issue.customfield_A?.value == 'Yes'
? issue.customfield_B != null && issue.customfield_C != null
: true

Change customfield_A, customfield_B, customfield_C, to field ids valid for your Jira. Start typing in the editor and you will get suggestions based on the name of your fields.

Finally, you can add a validation message to ensure users understand why the transition is blocked.

community_9.04.png

Full disclosure: I am from Forgappify, the vendor of the app.

Cheers

Deon Schaffer April 9, 2024

Thanks! That was really easy.  Much appreciated. 

Like Floating electron likes this
1 vote
Neel Mohapatra _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 8, 2024

Hi @Deon Schaffer ,

I wish you a good day!
I am from the appfire support team, and to achieve your use case, I would like to recommend you JMWE  app for the cloud.

1) you can choose to build your own scripted condition
Screenshot 2024-04-08 at 5.52.45 PM.png

2) then you can write the condition like below.

Screenshot 2024-04-08 at 6.18.02 PM.png
Once you click on issue fields, you can look for your field A ( like I have looked for 'Product short code' in above eg) and then it will show you available code options. You can hover your mouse over it to see what it does, and then you can click on it and the code will be selected .

eg:

if (!!issue.customfield_10049 && issue.customfield_10049.value == "IRIS") {
((!! issue.customfield_10050 && !! issue.customfield_10050.value) && issue.customfield_10048 != null)
}
else {
return true
}


the above code checks if issue.customfield_10049 is not empty and has the value IRIS
IF yes then it checks customfield_10050 is not empty
AND then it checks issue.customfield_10048 is not null (because it was text field and others are select list )
else it returns true

Once you have completed writing your code, you can click on the test Jira expression and choose the issue key to validate it.

Once you are satisfied with the result. You can save it.

Let me know if it helps!

Thanks!

Deon Schaffer April 8, 2024

Thanks. I will look into your App. Much appreciated. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events