JIRA expression Nested IF condition

Vignesh Kumar May 9, 2022

Hello All,

        We have a SIL validator in JIRA server version which has nested if conditions. Suprised to know that JIRA Cloud does not support SIL validators directly and have to use JIRA Expressions. Does JIRA Expressions support nested if conditions?

if(condition 1 is true){

      if(condition 2 is true){

       do something      

      }

}

2 answers

0 votes
Javier Perez
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.
October 22, 2023

Old ticket, but I just came across it while also looking for an answer to a similar question. For those who're still looking for this, jira expressions support if/else conditions (I haven't tried nested if, though, but I guess it should work). This is an example

if (issue.customfield_1234.value != "Not Required") { 
return true;
} else if (issue.project.key == 'PROJECT' ) {
new Issue('PROJECT-1234').description.plainText.includes(issue.customfield_1235);
} else if (issue.project.key == 'PROJECT2' ) {
new Issue('TEST-1235').description.plainText.includes(issue.customfield_1235);
} else {
return false;
}

 

0 votes
Oliver Siebenmarck _Polymetis Apps_
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 9, 2022

Hi @Vignesh Kumar ,

Welcome to the community and welcome to Jira Cloud!

Personally, I'm a huge fan of Jira Expressions, and I hope you'll come to like them.

Yes, nested conditions are possible and thankfully quite easy to do. Let's say you want a validator that checks that an issue is assigned and that its priority is medium. Here's how you'd do that:

issue.assignee != null && issue.priority == "Medium"

 Of course, you can also do OR and so much more, check out the documentation

Hope that helps,
 Oliver

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events