Storing results of multiple lookups, then using them all in one email?

Andrew February 28, 2025

The intent is to have the results of several filters used in several tables in one email report.
While the Lookup issues are able to pull up the tickets fine, I'm stumped at how to store the full results of each lookup, and then retrieve them to use in the email.

When running the automation, I end up with the error:
Advanced branching - Can't branch rule as no conditions/actions have been configured for it. Either delete Branch or add some components for the branch.

 


Currently I have the automation set up like this:
https://ibb.co/JRzpqN1C

The main tree starts with a daily "schedule", followed by the first "Then: Lookup Issues". Then a branch is set containing a "For each: Smart Value" and ends there. The main branch repeats another "Then: Lookup Issues", followed by a branch with "For each: Smart Value".

The main tree ends with a Then: Send Email

In the first "For each: Smart Value", I have the following configured:

Smart value: {{lookupIssues.key}}{{lookupIssues.summary}}{{lookupIssues.created}}{{lookupIssues.status.name}}{{lookupIssues.customfield_10098}}

Variable name: currentlyopentickets



I've tried creating a branch that uses "Branch rule / related issues" Type: Current issue.
Followed by a "Then: Create Variable" as well

When saving, The "For: Current Issue" displays an error:

This component may be incompatible One of the following needs to be produced earlier in the rule by the trigger or with a 'for each' branch for this component to work: Issue

 


 

Is this the correct way to store results and how do I use branches to accommodate multiple Lookup issues?

Thank you.


1 answer

1 vote
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 28, 2025

Hi @Andrew 

For a question like this, context is important for the community to help.  Please post the following with your question:

  • what type of project is this (e.g., company-managed, team-managed, etc.), 
  • an image of your complete automation rule in a single image for continuity,
  • images of any relevant actions / conditions / branches,
  • an image of the audit log details showing the rule execution, and
  • explain what is not working as expected and why you believe that to be the case.

Until we see those...

First, you initially asked about using multiple Lookup Issues action results in a rule.  That is not possible.  As a workaround, the results of one lookup action may be stored for later use, perhaps with the Create Lookup Table action.

 

Next, the error message "This component may be incompatible..." normally indicates your rule is using an action which requires an issue and none is present in the rule.

When using the Advanced Branch over smart values, that iterates over data and not issues.  And so the actions cannot "see" an issue.

 

Kind regards,
Bill

Andrew March 2, 2025

I apologize for the lack of information. Thank you for the Create Lookup Table action. I've tried it and it seems more 'correct' This is a sample setup with 2 "Then: Lookup issues".

  • Type of project: Company managed

 

sample.jpg


However, I've ended up with some different questions:

1. Are custom fields (In filters: cf[10098]) referenced in Lookup table as "{{lookupIssues.customfield_10098}}"?

2. Using alltickets.size to count the number of tickets returns the number of columns instead. Is there a different command available to count each key?

2. The output I'm getting in the email is all tickets are grouped in one row instead of having each ticket displaying on its own row. How do I spread them out?


table example.jpg


Table:

table.jpg


Thank you.
 

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.
March 2, 2025

First thing, sorry I was not more clear on how to store the data.  Here is the technique with a Lookup Table storing the Lookup Issues results as objects, so they can be iterated later.

  • action: Lookup Issues, with JQL to gather some issues
  • action: Create Lookup Table
    • name: varFirstLookupResults
      • key: first
      • value: {{lookupIssues}}
  • ...later when you need the first lookup's results, use this:
    • {{varFirstLookupResults.get("first")}}

The technique you show spitting up into fields will be quite difficult to manage later.

 

For your follow-up questions:

1. Are custom fields (In filters: cf[10098]) referenced in Lookup table as "{{lookupIssues.customfield_10098}}"?

Please see above, and the custom field ID is the same when an issue is in context: customfield_10098.

 

2. Using alltickets.size to count the number of tickets returns the number of columns instead. Is there a different command available to count each key?

Using the technique above, the count of issues from the first lookup would be:

{{varFirstLookupResults.get("first").size}}

 

Putting those ideas together, the information from the first lookup issues result could be iterated to create your table, no different from the second one.  Here I am demonstrating a bulleted list, which you may modify to create your HTML table rows.

My first lookup results:

{{#varFirstLookupResults.get("first")}}
* {{key}} -- {{summary}} -- {{status.name}}
{{/}}



My second lookup results:

{{#lookupIssues}}
* {{key}} -- {{summary}} -- {{status.name}}
{{/}}

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events