Forums

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

Smart Value variable fails in .equals() comparison, but hardcoded string works

Oscar Santillana
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 11, 2025

Hi everyone,

I'm running into a baffling issue with a Jira Automation rule where a variable comparison fails, even though logging shows the values should be identical. I'm hoping someone in the community has seen this before.

 


 

My Goal

 

When an issue in our main "PROD" project is moved to a new sprint (e.g., PROD_2025_W35_W36), I want to find the corresponding sprint in all of its linked issues (which are in different projects like "BSE", "QA") and update them automatically. The sprint names share a pattern but have a different project key (e.g., BSE_2025_W35_W36).

 


 

My Approach

 

I've built what I believe is a robust rule to handle this. Here is the logic within the branch for each linked issue:

  1. Create a lookup table (tblSprintIds) to dynamically find the correct Agile Board ID for each linked issue's project ({{tblSprintIds.get(issue.project.key)}}).

  2. Create a variable (sprintCalculated) to hold the exact target sprint name. The smart value is {{issue.project.key}}_{{triggerIssue.sprint.name.substringAfter("_").trim()}}.

  3. Send a web request to get all active and future sprints from the correct board using the Board ID from the lookup table. The URL is: .../rest/agile/1.0/board/{{tblSprintIds.get(issue.project.key)}}/sprint?state=active,future

  4. Find the Sprint ID by iterating through the webResponse and create a new variable sprintId.

  5. Edit the issue to set the sprint using the found sprintId.


 

The Problem

 

The rule executes without failing, but it never finds a result. The issue is in Step 4. I have isolated the problem to this specific smart value, which is supposed to find the ID:

{{#webResponse.body.values}}
  {{#if(equals(name, sprintCalculated))}}
    {{id}}
  {{/}}
{{/}}

This code always produces an empty result. However, if I hardcode the string, it works perfectly.

This works:

{{#webResponse.body.values}}
  {{#if(equals(name, "BSE_2025_W35_W36"))}}  <-- Hardcoded string
    {{id}}
  {{/}}
{{/}}

This correctly finds and returns the sprint ID (e.g., 2697).


 

What I've Tried

 

This seems like an issue with the sprintCalculated variable, but I've confirmed the following:

  • Logging: I've added a log action right before the failing step to print both the variable and the hardcoded string. They appear to be identical.

  • Trimming: I am using .trim() when creating the sprintCalculated variable to remove any potential leading/trailing whitespace.

  • Alternative Functions: I have also tried using the match() function with regex, which also fails to find a match when using the variable but works with a hardcoded string.

This proves that the webResponse data is correct and the if/equals logic is valid, but the variable sprintCalculated is not being treated the same as a literal string within the comparison.


 

My Question

 

Has anyone encountered a situation where a smart value variable fails in a comparison (.equals() or .match()), while a hardcoded string with the same value succeeds?

Is there a known issue with variable typing, scope, or hidden characters inside Jira's smart value engine that could explain this behavior?

Any insight would be greatly appreciated. Thanks!

1 answer

1 vote
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 11, 2025

Hi @Oscar Santillana -- Welcome to the Atlassian Community!

The symptom you describe is a long-standing limitation of automation rules:

Inside of a long-format, list iterator, only information from that level (or lower) is accessible.

Thus, your created variable cannot be "seen" inside to perform the filter.  The Atlassian automation team knows about this limitation and has tried several times to address it.

 

One possible workaround for this is using the inline-format of list iteration with a dynamic regular expression.  To learn about that technique, please see this article I wrote on it:

https://community.atlassian.com/forums/Automation-articles/Automation-concepts-Dynamic-searches-within-a-list/ba-p/2834235

 

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events