Heads up! On March 5, starting at 4:30 PM Central Time, our community will be undergoing scheduled maintenance for a few hours. During this time, you will find the site temporarily inaccessible. Thanks for your patience. Read more.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automation filter list two using "And" two different fields

Melissa
Contributor
January 27, 2025

Hello!

I need to filter down a list in our automation, Any suggestions welcomed!

Currently I'm using -- {{#Issues}}{{#if(equals(status.name, "Approved"))}} {{/}} 

But I need to narrow it down to only show items from Project XYZ

I'm not sure how to combine two different fields.  I tried 

{{#Issues}}{{#if(and(status.name, "Approved", project.key, "PP"))}} {{/}}    

{{#Issues}}{{#if(and(equals(status.name, "Approved", project.key, "PP")))}} {{/}} 

Documentation Shows the following for "and" but doesn't speak on combining two fields - {{and(smartValue1, smartvalue2)}} returns true or false {{#if(and(issue.Votes.gt(100),issue.Votes.lt(150)))}} Moderately Popular issue {{/}}

1 answer

0 votes
Bill Sheboy
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.
January 27, 2025

Hi @Melissa 

The and() function in smart value expressions takes two Boolean parameters; basically, any expressions which could evaluate to true or false

In the documentation example, the gt() and lt() functions return those Boolean values.

 

For your case, perhaps try using two equals() functions within the and() function:

{{#issues}}
{{#if(and(equals(status.name, "Approved"), equals(project.key, "PP")))}}
return something...
{{/}}
{{/}}

 

Please note well: the and() / or() functions only take two parameters.  When more expressions are needed, they must be nested.  Such as with this:

{{#issues}}
{{#if( and(myFirstExpression, and(mySecondExpression, myThirdExpression) ) )}}
return something...
{{/}}
{{/}}

 

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer