Forums

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

IsEmpty does not work on custom field

Michael Tai May 28, 2024

Step to reproduce.

1. Create a simple text custom field (my case is `Account holder's name`.

2. Add the custom field to a new Request type.

3. Create a Jira Automation triggered by this Request type.

4. In automation add a step to print the following comment

```

"{{issue.Account holder's name.value}}"

"{{not(issue.Account holder's name.value)}}"

"{{issue.Account holder's name.isEmpty}}"

"{{not(issue.Account holder's name.isEmpty)}}"

"{{issue.Account holder's name.value.isEmpty}}"

"{{issue.Account holder's name}}"

```

5. Raise a request ticket using the Request type created, don't fill in anything in your custom field.

6. Now you will get a comment

```

""

"true"

""

"true"

""

""

```

`IsEmpty` either returns null or true. It always returns' true' if I test it with `not(isEmpty)`. It is not correct. Am I doing sth wrong? I also tried `isNotEmpty`, but the result was the same, always `true` after `not`.

1 answer

1 accepted

1 vote
Answer accepted
Kalyan Sattaluri
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.
May 28, 2024

Hello @Michael Tai 

If Text 1 is your text field, then {{Text 1.isEmpty}} will give true/false based on if field has value.

Can you tell if {{issue.Account holder's name}} is returning value of the field? If it is not:

  • Put a refetch action right after the trigger and rerun the rule. OR
  • Instead of using field name {{Account holder's name}} , use its customfield value instead to try and log the value.

You need to be able to log the value successfully so you can evaluate if its empty or not.

Hope it helps and let me know if issues / concerns. Thanks!

Michael Tai May 28, 2024

Hi Kalyan,

 

I tried, in the comment I print `"{{issue.Account holder's name}}"`, it is `""`. It makes sense because I didn't fill in anything in this field. 

I have another field in this request type which I did fill in sth, and it is printing correctly.

It is already a refetch step after the trigger.

I just tested `"{{issue.customfield_11875.isEmpty}}"`, but still it returns me `""`

Kalyan Sattaluri
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.
May 28, 2024

Hello @Michael Tai 

isEmpty should have worked.. but if it does not.. Please try to log below value:

Below smart value explicitly checks if field is empty, if so, will return true..

{{#if(not(exists(customfield_11875)))}}true{{/}}

you can then use it in your conditional statements.

Hope it helps. Thanks!

Like Igor Fortunato likes this
Michael Tai May 28, 2024

Hi @Kalyan Sattaluri

 

Thanks! `exists` works! Though `isEmpty` is still not working, at least I have a workaround now.

Kalyan Sattaluri
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.
May 28, 2024

Hello @Michael Tai 

I checked and yes, for some fields isEmpty is not working and you need to use the if/exists condition to evaluate.

Please let us know issues and accept answer if it solves your issue so others can benefit. Thanks!

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 Leaders.
May 28, 2024

Hi @Michael Tai 

Yes, and...to Kalyan's suggestions:

I recall there can be differences in rules for some fields which were never set (i.e., null) versus set to a value and later cleared (i.e., now an empty string).  Worse still, the behavior may be different for the same field when the issue is an element in a list versus a single issue.  The only way to confirm is experimentation.

Kind regards,
Bill

Igor Fortunato
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 13, 2024

"Exists" also worked for me! Thanks @Kalyan Sattaluri !

Like Kalyan Sattaluri likes this

Suggest an answer

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

Atlassian Community Events