JMWE Cloud - How to structure If-Else conditions with variable return values (true or false)

Tom Gross December 1, 2023

I know how to access the parent information using Nunjucks (Thanks David) . 

{{targetIssue.fields.status.name == "In QA" or targetIssue.fields.status.name == "Ready for QA"}}

However, I'm having a hard time understanding on how to code the following with conditional logic? How do I force return value? The Nunjucks documentation isn't that clear, especially when using it in JMWE. There are links posted in the community to some Nunjucks documentation, but it appears the site is not working. Is there a good place to see JMWE examples formatted in Nunjucks?IF-Else.jpg

1 answer

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2023

Hi @Tom Gross 

if you want to keep the same kind of coding structure, you can use if blocks:

{% if issue.fields.subtasks | find("fields.status.name", "QA In Progress") %}
false
{% elif targetIssue.fields.status.name == "QA Not Started" %}
true
{% else %}
false
{% endif %} 

But you can simplify this into a single statement:

{{ not (issue.fields.subtasks | find("fields.status.name", "QA In Progress")) and targetIssue.fields.status.name == "QA Not Started" }}
Tom Gross December 4, 2023

Great.  It' try it out.

Where can I find a good Nunjucks resource?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events