Forums

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

Automation: issue when filtering with smart values during variable creation

Thibault DUCHATEAU
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 20, 2025

Hi there!
I am having a lot of trouble getting the following filter to work.

Context: I am making an API call that returns a list of messages.

I want to filter only the items on the following fields:
- metadata.event_type=“hardCodedString”
- metadata.event_payload.field=“{{value}}” <= value is (supposed to be) a string

A few notes:
- some items do not have a "metadata" field.
- some items do not have the "event_payload.field" field.

Here is the expression I am currently using:

{{#webResponse.body.messages}} 
{{#if(equals(metadata.event_type, "hardCodedString"))}}
{{#if(equals(metadata.event_payload.field, value))}}{{ts}}| {{/}}
{{/}}
{{/}}

Since the field “value” is unique (from a business perspective), I should only get one result or none at all.


However, I regularly end up with inconsistent results: items without metadata, items where the event_type does not match, and items where the field value (within event_payload) does not match.

Does anyone have any idea where the problem might be coming from?

Thanks!

1 answer

1 accepted

2 votes
Answer accepted
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.
August 20, 2025

Hi @Thibault DUCHATEAU -- Welcome to the Atlassian Community!

There is a known limitation of long-format list iteration where, once inside the iterator, only data from that scope and lower is accessible. 

Thus, your value cannot be "seen" inside to perform the filtering.  The Atlassian automation team knows about this, and according to other posts, has tried several times to solve this without success.  And, there are no built-in, JSON filtering functions for webResponses yet in rules.

 

Possible workarounds depend upon what you are trying to do with the filtered results:

  • Want to process them one by one
    • Use an advanced branch to iterate over the records and use Smart Value Conditions to test the values
  • Want to process them as a batch

 

Kind regards,
Bill

Thibault DUCHATEAU
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 20, 2025

Hello Bill,

Thank you for your welcome, thank you for your time, and thank you very much for your feedback.

The first suggestion based on advanced branch was not possible for me, as I would have been limited in terms of nesting if branches.

The second suggestion was exactly what I needed.

Thank you again!

Like Bill Sheboy likes this

Suggest an answer

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

Atlassian Community Events