Not sure if this is possible, but worth a shot.
I have an automation that successfully goes through epics, and reports via email. The child issue types of an epic are "Project Risk", "Project Blocker", "Project Decision".
I am able to report each issue type in a specific section of the email, by using the following:
{{#lookupIssues}}
{{#if(equals(issueType.name, "Project Blocker"))}}
Blocker: {{summary}} | {{status.name}}
{{/}}
{{/lookupIssues}}
My question is, if (in this example) there are NO Blockers, the section in the email is blank.
I would love for it to have some conditional logic within the email action that says "There are no Blockers." IF there are indeed no blockers.
Additionally, I only want it to write "There are no Blockers" one time. Not iterate through and write it multiple times (depending on the lookup results).
Thoughts?
Hi @Alex
Yes, that is possible, and could be done outside of your iterator over the values. And there are several ways to do this...
One inefficient way is... to use multiple calls to Lookup Issues, adjusting the JQL for each issue type, and then save each result's formatted output in a variable. Then check if that variable is empty to show your "There are no X" messages.
Staying with one Lookup Issues action call, you could still use filtering and generate a count for each type, storing that in a created variable, and then use those variables to decided if the message should be shown.
{{#=}}0{{#lookupIssues}}{{#if(equals(issueType.name, "Project Blocker"))}}+1{{/}}{{/}}{{/}}
some text...
{{#if(equals(varProjectBlockerCount, "0"))}}There are no Project Blockers.{{/}}
{{#lookupIssues}}
{{#if(equals(issueType.name, "Project Blocker"))}}
Blocker: {{summary}} | {{status.name}}
* Risk Impact: {{Risk Impact}}
* Mitigation Plan: {{Mitigation Plan}}
{{/}}
{{/}}
...repeat for other types
Please note that the "0" in the check is in quotation marks as variables are text. If you want that to check 0 instead, you may convert the variable using asNumber.
Kind regards,
Bill
Dude. This is very very slick.
That is all. :-O
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy - very slick indeed. Worked like a charm. Just fyi,
{{#=}}0{{#lookupIssues}}{{#if(equals(issueType.name, "Project Blocker")}}+1{{/}}{{/}}{{/}}
was missing a closed parenthesis - but otherwise, perfecto.
Thank you so much.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, and oops! That's what I get for typing stuff like this without trying it first, or using a code editor :^)
I updated my first post so the initial one has your correction.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.