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:


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?