Forums

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

Data in variable not showing in email.

Simon Sandrock April 11, 2024

Hello, 

I am trying to create an automated mail that sends some information daily to people. 

The data is defect statistics. 

The first step is using issue lookup to get the list I want. 

I then assign it to a lookup table, the idea is that I need multiple sets of data in one email. Think of issues created that day and issues closed for example. In practice, the queries are a bit more complicated.

Now this works fine and gives me the full list when I send it like this 

{{#created.get("created1")}}
* {{key}} - {{summary}}
{{/}}

To add more I thought to use Lookup issues again and assign the result to a variable. And then add the variable to my lookup table. 

Which then looks like this 

First data set 

{{#created.get("created1")}}
* {{key}} - {{summary}}
{{/}}

Second data set 


{{#created.get("created2")}}
* {{key}} - {{summary}}
{{/}}

The problem is I tried it with the same data and the {{lookupIssues}} one does correctly show all result from the query but the one based on the variable does only show one entry. 

So how do I get both to show the full list? 

Thank you all very much for your time and help. 

image.pngimage.png

 

1 answer

1 accepted

0 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.
April 11, 2024

Hi @Simon Sandrock 

When you saved the first lookup result as a variable, that converted it all to text.  It is no longer a list of issue objects that can be parsed, iterated, etc.

Without knowing the specifics of your JQL for the lookups, there are three possible workarounds:

  1. Use one Lookup Issues action, with JQL that spans both desired sets of issues.  Then use conditional logic (i.e., smart value, list filtering) for each measure / list of issues.
  2. When you create the variable, iterate over the values to save only the Key and Summary, preformatted as you wish, and with a delimiter such as "~~".  Then when using the table value, split it back on "~~" to use the list items, without any {{key}} or {{summary}} attributes.
  3. Use one Lookup and one Send Web Request action with a call to the REST API issue search to have two sets of issues.  Then the table is not needed as each result set may be iterated.

I recommend using the first one.  For example, let's say you wanted to list done and not-done issues.  That could be this:

Done Issues:
{{#lookupIssues}}
{{#if(equals(status.statusCategory.name,"Done"))}}* {{key}} - {{summary}}{{/}}
{{/}}

Not Done Issues:
{{#lookupIssues}}
{{#if(not(equals(status.statusCategory.name,"Done")))}}* {{key}} - {{summary}}{{/}}
{{/}}

Kind regards,
Bill

Simon Sandrock April 11, 2024

Thanks for your answer Bill

I could cover all issues with one query the problem is there is a good chance that sometimes the results will be over 100. 

Ideally, I  would just send a mail with the link to the dashboard or something simpler. But people want emails with issues in it and it might be a while till I have convinced them otherwise 

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.
April 11, 2024

Thanks for that additional information, and so perhaps try option #2 next:

  • create variable:
    • name: variableA
    • smart value:
{{#lookupIssues}}* {{key}} - {{summary}}{{^last}}~~{{/}}{{/}}
  • later when you want to walk those issues...
{{#variableA.split("~~")}}
{{.}}
{{/}}

 

Please adjust the creation of variableA to contain the fields / format needed.

 

Like Simon Sandrock likes this
Simon Sandrock April 11, 2024

That seems to work, thank you very much

Like Bill Sheboy likes this

Suggest an answer

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

Atlassian Community Events