Forums

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

Error on Rule that Compare field Value and Set Value

Jack Yang
Contributor
June 1, 2026

Hi everyone,

 

I set a automation rule to compare value between 2 date picker field, if it's less than 3 days, then set another field value to 5, if between 3 and 7 days, set to 4, etc.

Here is the smart value I put in {{issue.Start Date (migrated).daysBetween(issue.Contained Date).abs}}
However, no matter what dates I pick, it all passed first if block (less than 3)

Unable to resolve this even I tried solutions that provided by AI, anyone can help?

 

Screenshot 2026-06-01 at 4.44.58 PM.pngScreenshot 2026-06-01 at 4.45.45 PM.png

 

Thanks in advanced

Jack

2 answers

2 accepted

5 votes
Answer accepted
Yashaswini YK
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.
June 1, 2026

Hi @Jack Yang ,

Replace the smart value with:

{{issue.migrated.diff(issue.Contained Date).days.abs}}

and keep the rest of the automation unchanged.

This worked successfully in my instance. I've attached a screenshot below for reference.


Screenshot 2026-06-01 145952.png

Screenshot 2026-06-01 145913.png

Jack Yang
Contributor
June 1, 2026

Thanks @Yashaswini YK for your quick response, it works properly now, thanks again for your help.

Like # people like this
5 votes
Answer accepted
Artem Nek
Contributor
June 1, 2026

Hi Jack,

The problem is the smart value itself: daysBetween isn't a function in Jira
automation, so the whole expression never resolves to a number. With the left
side of your "less than 3" check blank, that first branch passes every time —
which is exactly what your audit log shows.

There's a single date-difference function, .diff(), and you append the unit,
then .abs:

{{issue.Start Date (migrated).diff(issue.Contained Date).days.abs}}

(order is unit-then-abs — straight from the docs, e.g.
{{now.diff(issue.created).days.abs}})

Two things worth checking while you're in there:

1) Confirm it actually resolves. Add a "Log action" (or write it to a temp
field) containing just that smart value and run the rule once — you should
get a number like 5, not a blank and not the raw {{...}} text. If it comes
back blank, the field reference is the culprit: "Start Date (migrated)"
with
the space and parentheses can be unreliable, so try the customfield_XXXXX
id
instead, or add .toDate("yyyy-MM-dd") before .diff() if that migrated field
is being returned as text rather than a date.

2) Check the branch logic. If those are separate "if" blocks rather than one
If / Else-if chain, more than one can fire. For "<3 → 5, 3–7 → 4, …" put
them
in a single If / Else-if and order them narrowest-first so the ranges don't
overlap.

Date function reference

Jack Yang
Contributor
June 1, 2026

Thanks @Artem Nek  for your quick response, it works properly now, thanks again for your help.

Like # people like 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.
June 1, 2026

Hi @Jack Yang 

Yes, and...to the suggestions from @Artem Nek 

When performing date / time differences, please consider your scenario before adding the absolute value (i.e., abs function) at the end.  Perhaps it is an entry error when a person enters the values such that the result is a negative number, and so adding the abs function will conceal that problem.

 

Please note smart values are name, spacing, and case-sensitive, and often do not exactly match the field name shown in the UX.  When an unknown smart value is used, that evaluates to null, often failing silently.  This is one reason the suggestion to use the custom field ID can help.  To confirm you have the correct smart value or custom field ID, please use one of these methods:

  1. In the rule editor, on an action / condition for the smart value, note the { } icon at the right side, and select that to find your field's information.
  2. The above noted method may be incorrect in some cases.  To confirm the smart values / custom field IDs which are actually supported in rules, use this how-to article, where one uses a browser to call the REST API to check the fields in an example work item.

 

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events