Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Cloud - Filtering out multiple statuses in lookupIssues results

Andrew June 13, 2023

Hi,

New to this and I'm trying to filter out the results of a lookupIssues in Automation, to only show tickets that contain certain status.

 

So far, I've found that trying to stack 3 or more sets of "status.name.startsWith("Status1")," into an if statement makes it stop working completely (2 works fine), and so does "status.name.startsWith("Status1","Status2"),"

Are there alternatives to this? Perhaps some sort of nested If..not(1)..or(2)..or(3) to exclude the categories with only 2-3 statuses of interest?

 

Thank you.

 

EDIT: So I've stumbled across saving lookupIssues results into a Create Variable, to store several different queries in the same Automation. If it allows storing a table of data a link to any guide out there regarding saving the data is appreciated.

2 answers

1 accepted

1 vote
Answer accepted
Andrew June 14, 2023

This is what worked for me. Its not neat, but this creates a table in Send Email, based off lookupIssues results, using 4 filters as an example:

<h2>Example multi filter table:</h2>
<table cellspacing="1" cellpadding="5" border="0" bgcolor="#000000"><tr bgcolor="#ffffff"><td>Type</td><td>Key⠀⠀⠀</td><td>Summary</td><td>Status</td><td>Updated</td><td>Next Steps</td></tr>
{{#lookupIssues}}{{#if(or(or(status.name.startsWith("Status1"),status.name.startsWith("Status2")),or(status.name.startsWith("Status3"),status.name.startsWith("Status4"))))}}
<tr bgcolor="#ffffff"><td>{{issueType.name}}</td><td>{{key}}</td><td>{{summary}}</td><td>{{status.name}}</td><td>{{updated.jqlDateTime}}</td><td>{{next steps}}</td></tr>{{/}}{{/}}</table>

1 vote
Deepak Jain
Community Champion
June 13, 2023

Hi @Andrew ,

You can use || or operator in one if condition, something like this: 

 

if (status.name.startsWith("Status1") || status.name.startsWith("Status2") || status.name.startsWith("Status3")) {

 

}

 

Thanks!!

Andrew June 13, 2023

Hi @Deepak Jain 

Apologies for the mess, I'm trying out the below code and getting a "Error rendering smart-values when executing this rule" error:

<table cellspacing="1" cellpadding="5" border="0" bgcolor="#000000"><tr bgcolor="#ffffff"><td>Type</td><td>Key⠀⠀⠀</td><td>Summary</td><td>Status</td><td>Updated</td><td>Next Steps</td></tr>
{{#lookupIssues}}{{#if(status.name.startsWith("Status1")||status.name.startsWith("Status2")||status.name.startsWith("Status3"))}}
<tr bgcolor="#ffffff"><td>{{issueType.name}}</td><td>{{key}}</td><td>{{summary}}</td><td>{{status.name}}</td><td>{{updated.jqlDateTime}}</td><td>{{next steps}}</td></tr>{{/}}{{/}}</table>


Do I place the entire table between the { }, or is there something I missed?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events