Arrays in Automation
Asked by Harry Heathcote:

Hi,

I'm trying to make a custom report for satisfaction and other details using the automation tool.

I'm in need of an array or a method in which to parse all the tickets using a query and then storing all the data in some form that's then accessible to then put into an email and be sent to a team of people.

I figured as I couldn't see any array function I would us the description of the first ticket logged in our system as this was a test ticket.

This is what I have so far.

![Capture.PNG](/t5/image/serverpage/image-id/97200iAB114EF7284B45AF/image-dimensions/206x427?v=v2 "Capture.PNG")

So with that I can mark using a comment all the issues that need to be in the report. The bit I can't do is collate all the issues into one list/array of data that I can then send on.

One other thing is that if its possible to direct a smart value to a location. So I parse the data from a ticket using a custom field then write that data to a different field in a different issue/ticket.

If anyone has an idea for this. Any help is appreciated.

Thanks


Answers:
author: Bill Sheboy
body: Hi [@Harry Heathcote](/t5/user/viewprofilepage/user-id/3851842)

Did you figure out how to do this yet? If not...Have you investigated using the actions of Lookup Issues and Create Variable?

With lookup issues you can use JQL to get a list of issues, and then parse some of the fields, storing the results in a variable.

For example, if you had a JQL statement that populated a lookup, you could put into a variable something like this:

```
<ul>{{#lookupIssues}}<li><a href="{{url}}">{{key}} - {{summary}}</a></li>{{/}}</ul>
```

Which would give you a simple HTML list of the issues, their summaries, and links to them. The variable could be used to build this list into a single email.

Please look here for information on the actions [Lookup Issues](https://support.atlassian.com/jira-software-cloud/docs/smart-values-general/) and [Create Variable](https://support.atlassian.com/jira-software-cloud/docs/automation-actions/) and look here for information on [list handling](https://support.atlassian.com/jira-software-cloud/docs/smart-values-lists/).

Best regards,

Bill

comments: author: Harry Heathcote
body: Hi [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)

Thanks for your answer and sorry for the late response.

I have been looking into it some more as I have the time to do so again but this time for a different problem.

As it currently stands, I understand some parts regarding lists but not where to apply them.

The example you gave to get a list of issues in a HTML format.

Where do I put this?

I have tried putting in a create variable segment that's inside a FOR loop to iterate over all tickets matching a JQL query but when I get the email it sends there is no data in it. So, what is it really doing?

![2021-02-17 12_42_24-Clipboard.png](https://community.atlassian.com/t5/image/serverpage/image-id/130773i4E04F253E66F3D3C/image-size/large?v=v2&px=999 "2021-02-17 12_42_24-Clipboard.png")

Thanks,

Harry


author: Bill Sheboy
body: Hi, Harry! Thanks for clarifying, and sorry I didn't explain my idea better.

When you use a **Branch** you may process each issue, one at a time. I was instead suggesting using **LookupIssues** to process the set of issues. Using that method your rule would be something like this:

* Trigger: manual, as you noted
* Action: LookupIssues with your JQL
* Action: send email, with HTML and the LookupIssues data as this in the email body

```
Here is the list:
<ul>
{{#lookupIssues}}
<li><a href="{{url}}">{{key}} - {{summary}}</a></li>
{{/}}
</ul>
```

Best regards,

Bill


author: Harry Heathcote
body: Hi bill,

Thanks for this, exactly what I was after.

1 last question for you.

How do I go about adding other fields to this?

The below I have already tried but with no luck,

```
Here is the list:
<ul>
{{#lookupIssues}}
<li><a href="{{url}}">{{key}} - {{summary}}</a>
Location: {{issue.customfield_10395.value}}
Description:
{{issue.customfield_10388.content.text}}

</li>
{{/}}
</ul>
```

Thanks,

Harry


author: Bill Sheboy
body: Hi Harry,

I am glad to hear that helped you, and I'm afraid that [Lookup Issues](https://support.atlassian.com/jira-software-cloud/docs/automation-actions/#Automationactions-Lookupissues) only works for a limited number of fields at this time:
> From the resulting issue list, the following issue properties are available to use (custom fields aren't available):
>
> * {{key}} - Returns the issue key
>
> * {{url}} - Returns the issue url
>
> * {{summary}} - Returns the issue summary
>
> * {{assignee.displayName}} - Returns the assignee
>
> * {{reporter.displayName}} - Returns the reporter
>
> * {{status}} - Returns the status
>
> * {{issueType}} - Returns the issue type
>
> * {{resolution}} - Returns the resolution status
>
> * {{fixVersion}} - Returns the fix version
>
> * {{created}} - Returns the date the issue was created
>
> * {{updated}} - Returns the date the issue was updated
>
> * {{Story Points}} - Returns the story points for the issue (classic Jira Software)
>
> * {{Story point estimate}} - Returns the story points for the issue (next-gen Jira Software). Learn more about using smart values with numbers.

There is an open suggestion to add more fields, which you may review and vote for here:

<https://jira.atlassian.com/browse/JRACLOUD-75018>


author: Harry Heathcote
body: That makes sense.

Thanks for the response.

I will keep an eye on that as it would be very helpful.

Thanks,

Harry


Tags: jira-cloud