Forums

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

Jira Automation: #for and #if block helpers fail with functions and arrays

Joshy Chirayath
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!
March 19, 2026

Smart value block helpers (#if, #for) in Jira Automation fail or behave inconsistently when using functions inside, especially with dynamic property access, array iteration, and function calls in block conditions or within loops.

Example-

Given config = [{"version": "1.2.3", "env": "PROD"}, {"version": "1.2.4", "env": "TEST"}]
When attempt to iterate and filter using -

{{#for(jsonStringToObject(config))}}
   {{#if(equals(version, "1.2.4"))}}
      {{env}}
   {{/if(equals(version, "1.2.4"))}}
{{/for(jsonStringToObject(config))}}

Then 
-this produces no output (empty),
- no error is shown,
- documentation is unclear if this feature has issues.

Expected result:
- Block helpers should support function calls and dynamic conditions,
- If not supported, documentation should clearly state the limitations and advise a roadmap.

Any suggestions? 

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 Champions.
March 19, 2026

Hi @Joshy Chirayath -- Welcome to the Atlassian Community!

First, your initial expression is not a valid JSON string; thus, the jsonStringToObject function cannot parse it.  Please try this:

{
"config" : [
{
"version": "1.2.3",
"env": "PROD"
},
{
"version": "1.2.4",
"env": "TEST"
}
]
}

Next, there is no #for() function in automation rule, list iteration: there is a long-format iterator and an inline-format (which just uses dot-notation on one object / attribute at a time).

Please try this to get the result I believe you are seeking with a conditional, list filter:

Assuming your above JSON text was stored in a variable named varMyJson.

{{#jsonStringToObject(varMyJson).config}}
{{#if(equals(version, "1.2.4"))}}
{{env}}
{{/}}
{{/}}

Note that the "config" attribute is referenced after the function in order to provide a list to the iterator.

 

Kind regards,
Bill

Joshy Chirayath
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!
March 19, 2026

Thank you , it works!
I'm however wanting to use a variable for the search, e.g. thisVersion = "1.2.4" in which case this doesn't seem to return any value. Thoughts?

{{#jsonStringToObject(varMyJson).config}}
{{#if(equals(version, thisVersion))}}
{{env}}
{{/}}
{{/}}
Like Bill Sheboy likes this
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 Champions.
March 19, 2026

Awesome; I am glad to learn that helped!

 

Regarding using the variable for the list filter, that will not work directly: there is a long-standing limitation where only data from the iterator scope, and lower, can be accessed inside a long-format iterator.

Here is one of the open defects / suggestions for that limitation.

 

With Jira Cloud and your specific scenario, there are two possible workarounds:

 

Like Joshy Chirayath likes this

Suggest an answer

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

Atlassian Community Events