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.
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
).
I've built what I believe is a robust rule to handle this. Here is the logic within the branch for each linked issue:
Create a lookup table (tblSprintIds
) to dynamically find the correct Agile Board ID for each linked issue's project ({{tblSprintIds.get(issue.project.key)}}
).
Create a variable (sprintCalculated
) to hold the exact target sprint name. The smart value is {{issue.project.key}}_{{triggerIssue.sprint.name.substringAfter("_").trim()}}
.
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
Find the Sprint ID by iterating through the webResponse
and create a new variable sprintId
.
Edit the issue to set the sprint using the found sprintId
.
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
).
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.
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!
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:
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.