Block conditions fail and return nothing

Patrik Štoural
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!
February 19, 2025

 

Hello,

Can somebody help with the inline or block condition in the "Description field"?
I understand this is not an ideal solution, but what we are trying to achieve is to return fields that are not empty to the Description field. The information is collected from the form with conditions like if this is a field, the user must fill in this additional information.

Problem: Fields enclosed in the condition return empty even though the field contains a value. I tried using function .exist, but that doesn't help.

 

*Název / Working title:* {{issue.summary}} *Priorita / Priority:* {{issue.priority.name}} *Termín / Deadline* {{issue.dueDate.mediumDate}} *Tvé jméno / Your name* {{issue.reporter.displayName}} *Co potřebuješ? / What do you need?* {{#issue.customfield_11734}} - {{value}} {{/issue.customfield_11734}} {{#if(not(issue.customfield_11735.isEmpty))}} *Komunikační kanály / Communication channels* {{#issue.customfield_11735}} - {{value}} {{/issue.customfield_11735}} {{/if}} {{#if(not(issue.customfield_11736.isEmpty))}} *Doplňující info / Additional details* {{#issue.customfield_11736}} - {{value}} {{/issue.customfield_11736}} {{/if}} {{#if(not(issue.customfield_11737.isEmpty))}} *Název kódu / Name of the code* {{issue.customfield_11737}} {{/if}} {{#if(exists(issue.customfield_11738))}} *Max. počet použití celkem* {{issue.customfield_11738}} {{/if}} {{#if(exists(issue.customfield_11739))}} *Max. počet použití na uživatele* {{issue.customfield_11739}} {{/if}} {{#if(exists(issue.customfield_11740))}} *Uveď všechny údaje na vizitku a počet kusů. / Enter the business card details and quantity.* {{issue.customfield_11740}} {{/if}} {{#if(exists(issue.customfield_11741))}} *Jaký formát potřebuješ? (.ppt, .pdf, .jpg a další) / What type of format do you need?* {{issue.customfield_11741}} {{/if}} {{#if(exists(issue.customfield_11742))}} *O co přesně se jedná? / Tell us what you need?* {{issue.customfield_11742}} {{/if}} *Cílová skupina / Target group* {{#issue.customfield_11731}} - {{value}} {{/issue.customfield_11731}} {{#if(exists(issue.customfield_11732))}} *Kdo? / Who?* {{issue.customfield_11732}} {{/if}} *CZECH Context & Background - Detailní zadání* {{issue.description}} *ENGLISH Context & Background - Detailed info* {{issue.customfield_10326}} *Kterých entit se to týká? / What entity does it concern?* {{#issue.customfield_11733}} - {{value}} {{/issue.customfield_11733}}

Thank you for any suggestions on how to solve this problem.

1 answer

1 accepted

3 votes
Answer accepted
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.
February 19, 2025

Hi @Patrik Štoural -- Welcome to the Atlassian Community!

Short answer: the isEmpty() function does not work for all field types and conditions as it is intended for text values.  Experimentation is required to confirm what is needed.

 

First thing: the example you show is quite long and potentially complicated, making maintenance very difficult.  I recommend breaking that up to determine the value for each field, storing the result in multiple Created Variables.  Then the variables may be written to the audit log to check progress and combined for your final need (e.g., setting the Description field).

Back to your question...

For a text field, the isEmpty() function will work.

That will not work for other field types.  For example, a multiple-select option field is a list, and so it may be better to check the number of elements selected with list functions: {{issue.myMultipleSelectField.value.size.eq(0)}}

Other fields have additional challenges.  For example, the difference between empty, blank, and if the field previously had a value which was later cleared.

My recommendations are:

  • Create a test rule, with a scheduled or manual trigger to run for just one example issue
  • Use the Log action repeatedly to write various ways to test each field needed.  For example:
Test myMultipleSelectField with isEmpty: {{issue.myMultipleSelectField.isEmpty()}}

Test myMultipleSelectField.value with isEmpty: {{issue.myMultipleSelectField.value.isEmpty()}}

Test myMultipleSelectField.value.size: {{issue.myMultipleSelectField.value.size.eq(0)}}
  • Experiment until you find the syntax needed

 

Kind regards,
Bill

Patrik Štoural
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!
February 20, 2025

Hello,

Yea,h you are right.

The problem was in:

Incorrect Closing Tags: The use of {{/if}} instead of {{/}} resulted in parsing errors.

Improper use Of isEmpty:

  • For the list. as "size" was the right option
  • For the text fields used, "exist()" instead of isEmpty a little different but does the
    job I needed
  • For the number fields use nothing as it works example customfield 11738

 

*Název / Working title:*

{{issue.summary}}

*Priorita / Priority:*

{{issue.priority.name}}

*Termín / Deadline*

{{issue.dueDate.mediumDate}}

*Tvé jméno / Your name*

{{issue.reporter.displayName}}

*Co potřebuješ? / What do you need?*

{{#if(issue.customfield_11734.size)}}

  {{#issue.customfield_11734}}

    - {{value}}

  {{/issue.customfield_11734}}

{{/}}

{{#if(issue.customfield_11735.size)}}

*Komunikační kanály / Communication channels*

{{#issue.customfield_11735}}

  - {{value}}

{{/issue.customfield_11735}}

{{/}}

{{#if(issue.customfield_11736.size)}}

*Doplňující info / Additional details*

{{#issue.customfield_11736}}

  - {{value}}

{{/issue.customfield_11736}}

{{/}}

{{#if(exists(issue.customfield_11737))}}

*Název kódu / Name of the code*

{{issue.customfield_11737}}

{{/}}

{{#if(issue.customfield_11738)}}

*Max. počet použití celkem*

{{issue.customfield_11738}}

{{/}}

{{#if(issue.customfield_11739)}}

*Max. počet použití na uživatele*

{{issue.customfield_11739}}

{{/}}

{{#if(exists(issue.customfield_11740))}}

*Uveď všechny údaje na vizitku a počet kusů. / Enter the business card details and quantity.*

{{issue.customfield_11740}}

{{/}}

{{#if(exists(issue.customfield_11741))}}

*Jaký formát potřebuješ? (.ppt, .pdf, .jpg a další) / What type of format do you need?*

{{issue.customfield_11741}}

{{/}}

{{#if(exists(issue.customfield_11742))}}

*O co přesně se jedná? / Tell us what you need?*

{{issue.customfield_11742}}

{{/}}

*Cílová skupina / Target group*

{{#if(issue.customfield_11731.size)}}

  {{#issue.customfield_11731}}

    - {{value}}

  {{/issue.customfield_11731}}

{{/}}

{{#if(exists(issue.customfield_11732))}}

*Kdo? / Who?*

{{issue.customfield_11732}}

{{/}}

*CZECH Context & Background - Detailní zadání*

{{issue.description}}

*ENGLISH Context & Background - Detailed info*

{{issue.customfield_10326}}

*Kterých entit se to týká? / What entity does it concern?*

{{#if(issue.customfield_11733.size)}}

  {{#issue.customfield_11733}}

    - {{value}}

  {{/issue.customfield_11733}}

{{/}}
Like Bill Sheboy 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.
February 20, 2025

Well done, and just an FYI...

exists() checks for null (or not null) and isEmpty() checks for blank (or not blank).  That second one usually returns the same result for text fields, but for other fields testing is required.

Like Patrik Štoural likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events