Forums

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

Issue with conditional logic on smart value (changelog) if value is null or empty

Olliver Ordell
January 22, 2026

Hi there,

I'm writing a pretty advanced and long automation (that works), but I'm having issues operating on some smart values.

In my automation I'm creating a new comment, that tells the user that the priority has changed due to A, B, C, ... etc. I do this with conditional logic like so:

Priority changed from *{{originalPriority}}* to *{{issue.priority.name}}* due to:

{{#if(exists(changelog.days until code freeze))}}
Days until code-freeze changed:
- From: _{{changelog.days until code freeze.fromString|"none"}} days_
- To: _{{changelog.days until code freeze.toString|"none"}} days_
{{/}}
{{#if(exists(changelog.Severity))}}
Severity changed:
- From: _{{changelog.Severity.fromString|"empty"}}_
- To: _{{changelog.Severity.toString|"empty"}}_
{{/}}
{{#if(exists(changelog.Likelihood))}}
Likelihood changed:
- From: _{{changelog.Likelihood.fromString|"empty"}}_
- To: _{{changelog.Likelihood.toString|"empty"}}_
{{/}}

This works, and only writes in the comment in one of these fields has changed. However, there is one issue.

If the field "days until code freeze" (a read-only text field) is updated in the {{changelog}} variable, there is a difference between going from an empty value and to an empty value.

Here is an example of the {{changelog}} value when coming from an empty value:

{days until code freeze=[ChangeItemBean{fieldId='customfield_19356', field='days until code freeze', fieldType='null', from='null', fromString='null', to='null', toString='-83'}]}

And here is the value when it goes to an empty value:

{days until code freeze=[ChangeItemBean{fieldId='customfield_19356', field='days until code freeze', fieldType='null', from='null', fromString='-83', to='null', toString=''}]}

The field is a read-only text field, and is only updated by another automation. Note how the first instance has fromString='null' and the second has toString=''. 

I would also like to emphasize that the other automation that changes this field is either putting a value into it, or clearing it. It is not writing "null" to it. So it seams to me that there is a inconsistency in Jira right here.

Why is this an issue? 

My issue is that the comment comes out like the photos I've included:

Screenshot 2026-01-22 at 13.25.22.png

Screenshot 2026-01-22 at 13.26.11.png

See how if the value is 'null' it gets replaced by "none", but if the value is "", it doesn't get replaced with "none". I've tried to fix this by testing out the following, but nothing has worked:

- To: _{{#if(equal(changelog.days until code freeze.toString,""))}}none{{/}}{{changelog.days until code freeze.toString|"none"}} days_
- To: _{{#if(equal(changelog.days until code freeze.toString.lenght(),0))}}none{{/}}{{changelog.days until code freeze.toString|"none"}} days_
- To: _{{#if(not(changelog.days until code freeze.toString))}}none{{/}}{{changelog.days until code freeze.toString|"none"}} days_
- To: _{{#if(changelog.days until code freeze.toString.empty())}}none{{/}}{{changelog.days until code freeze.toString|"none"}} days_

Does anyone know how to fix this?

3 answers

1 vote
Marc -Devoteam-
Community Champion
January 22, 2026

HI @Olliver Ordell 

The "null" option in Jira means the field in the DB for this issue is empty.

So to my knowledge you need to set to a value like 0

As I expect the fields used are number fields, they can't contain value "none" you can only set a number or use value "null" as well.

Olliver Ordell
January 22, 2026

In my case, I need to clear the field completely, as any valid number in this field is valid and used in calculating the priority of the ticket.

 

It is a custom read-only text-field, not a numbers field, so any text and / or number is valid.

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.
January 22, 2026

Hi @Olliver Ordell 

Yes, and...to the other suggestions provided: the short answer is experimentation is always required to identify and manage "empty" values in automation rules.

Outside of Jira and automation rules, normally field values in IT products can be null, empty, non-empty, or undefined...subject to the implementation details.  And, based upon field types, we get into other nuances such as when a field with a non-empty value is cleared, does it become null or empty or undefined?

Things get trickier with automation rules, as the changelogs presented to rules are not always consistent with what we see in the work item histories, either in the UX or via the REST API endpoint responses.  Worse still, there may be different behaviors when lists are involved and we are checking values inside of iterators (such as for the changelog of multiple field changes).

A workaround I have used when the changelog appears to have inconsistent results is to first store the entire changelog provided to the rule in a Created Variable.  That will convert it to text, and at least allow consistent parsing to detect different scenarios.

 

Kind regards,
Bill

Olliver Ordell
January 22, 2026

I think you are right. This looks like undefined behavior. 

I will take you advice and experiment with storing the changelog in a new variable, and see if I can get the desired result.

But the fact that the changelog produce different results based on if the field was populated or cleared is baffling to me. 

0 votes
Christos Markoulatos -Relational-
Community Champion
January 22, 2026

Hi @Olliver Ordell 

i believe that ff the value is "", Jira will not replace it with "none" unless you normalize it first using .replace("null","").trim

i think Jira doesn't treat "" as empty in changelog smart values.
try it and let us know

 

Olliver Ordell
January 22, 2026

I tried this, but the issue is that ".replace("null", "")" never does anything. Neither does ".replace("", "")", as the value in the "toString" seams to be neither "null" or an empty string, which seams insane. I think @Bill Sheboy is right - this is undefined behavior.

Suggest an answer

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

Atlassian Community Events