Forums

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

SmartValues - Boolean Evaluation Breaks when Embedded in IF conditional

Kevin Altman
Contributor
July 21, 2025

When using SmartValues in an automation (trying to make a dynamic comment depending on IF conditionals), I am having issues with a function chain which returns true, not working properly when I embed that function chain into an IF block. 

Example:
Test: {{sprint.endDate.minusBusinessDays(5).isBefore(now)}}

Output (validated via Log Action):
Test: true

Failing example:
Test Fail: {{#if(sprint.endDate.minusBusinessDays(5).isBefore(now))}}TRUE{{/}}

Output (validated via Log Action), no text logged, expected "TRUE":
Test Fail: 

Something about putting the function chain here is not working with IF, but all examples in docs I can find seem to do this without issue. Help?

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.
July 21, 2025

Hi @Kevin Altman 

Context is important for automation rule questions.  Please post the following to provide more information:

  • an image of your entire rule in one single image for continuity
  • an image of the action / condition where you are using that expression
  • an image of the audit log details showing the rule execution

Until we see those...

 

Your expression references {{sprint...}} as the starting point for the conditional check.  If that "sprint" is referencing the field in a work item, that field is a list of sprints and not a single value.  Thus it could return the result based on the prior and current sprints to which the work item was assigned, producing a list result such as:

[true, true, true, false]

That list will not work with a long-format conditional expression.  Even when the work item has been in only one sprint, the result would be a list and not a single Boolean result:

[true]

Assuming the work item has been in one-and-only-one sprint, you could use this:

{{#if(issue.sprint.first.endDate.minusBusinessDays(5).isBefore(now))}}TRUE{{/}}

 

If you need to check a specific sprint, such as the active one, please let me know and I can describe the changes needed.

 

Kind regards,
Bill

Kevin Altman
Contributor
July 21, 2025

Hi Bill, I do need to check the active sprint. You referenced a field sprint value but I'm not accessing via issue.sprint, I'm accessing via sprint.endDate as shown in my example.

This is a documented function that 'Returns the end date of the sprint' and makes no mention of how multiple sprints are handled. However I tested this after you mentioned it and it seems to return an array in that scenario:

sprintEndDate: Fri Jun 06 06:00:00 GMT 2025, Thu Jul 24 05:00:00 GMT 2025

So the return type definition seems to omit how data might be encapsulated in arrays, which is misleading and likely the culprit. Can you suggest the best approach for active sprint?

If JIRA doesn't render arrays with [ ] in debugging, that certainly makes it confusing to understand data types. e.g. 'true' instead of ['true']

Like John Funk 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 Leaders.
July 21, 2025

When the rule trigger is sprint-related, there is a single value in {{sprint}} including all of its properties (e.g., endDate).

 

When a work item is in scope in the rule, it contains {{issue.sprint}} and that is a list of all of the sprints to which the work item has been assigned.  This may be confirmed using this documentation, how-to article to find the supported smart values for a specific work item: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

To learn more about handling lists and list fields in rules, please see this information: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/

 

Please note well: when a rule only references {{sprint}} it may actually resolve to {{issue.sprint}} and thus the rule structure is key to understanding which objects are involved: a single sprint, a specific work item's sprints, or a list-of-lists with work items' sprints (i.e., with Lookup Work Items results).

 

Again, without seeing your rule specifics, we could assume the following:

GIVEN a work item
AND it has been assigned to one or more sprints, including the active one
WHEN something happens
THEN return the endDate of the active sprint for additional calculations

There are many ways to find that date, including iterating the sprints in the work item, filtering by the state:

{{#issue.sprint}}{{#if(equals(state, "active"))}}{{endDate}}{{/}}{{/}}

This would return one date or null, and is best stored in a Created Variable for later use and to help diagnose rule problems.

Like John Funk likes this
Kevin Altman
Contributor
July 21, 2025

Thanks, sorry I thought I gave enough context (my log action was the only action in my automation), but the trigger seems relevant too. This is intended to be scheduled daily to check for items in an active sprint and then do some actions, just trying to get the filtering working first.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events