Scheduling a weekly summary status report via slack
Asked by Dana Weinbaum:

Hi,

I'm trying to create an automation to run weekly, that will provide a summary of customer-initiated bugs for the team. The ideal slack message will look like this:

- Total number of open bugs: ## (Jira chart that shows the total number sliced by domain)

- Bugs that were created in the past week: ## (Jira chart...)

- Bugs that are not assigned to any sprint: ## (Jira chart...)

- etc....

I know I can create multiple automations for that, each having a lookup issues rule and a slack automation action, but I wonder if there's a more elegant way of using a single automation for that.

I asked GPT and it suggested to use multiple lookup issues with a single slack message, but that didn't work.

It than suggested to create branching and put the different lookup issues + slack message in each branch but that didn't work.

Any ideas?

BTW is it possible to reference a chart and to send it? wouldn't that be amazing?? but obviously I'm willing to give that part up :-)

Appreciate any help


Answers:
author: Bill Sheboy
body: Hi [@Dana Weinbaum](/t5/user/viewprofilepage/user-id/5255605)

For a question like this, please post an image of your complete automation rule, 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. Those will provide context for the community to offer ideas. Thanks!

Until we see those...

Without seeing your rule specifics, I hypothesize you may use one single lookup issues action, [list filtering](https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588), and [math expressions](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/) to put the counts / information in a single Slack message. Or, you could use multiple lookups and save the results with [Create Variable](https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Create-variable) or [Create Lookup Table](https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Create-lookup-table), and use those later in your message.

Regarding sending charts, that is not possible with built-in features of rules. For existing Jira users, you could send them a link to a dashboard page with this information visualized. It is also possible to build a histogram using characters...although that can be a bit complicated in a rule.

Kind regards,  
Bill

comments: author: Dana Weinbaum
body: Thanks for replying Bill. Maybe I wasn't clear, I don't have an automation as I don't really know how to approach it.

The filtering link you shared seems to be the solution, but I couldn't find in it or in the documentation any filtering option.

The way I envision it is something like:  
Trigger: scheduled

Then: lookup issues (with a query to find all open bugs)

Then: send a slack message:

_\*Updated status of customer-initiated bugs:\*_  
- Total number of bugs: {{lookupIssues.size}} {{/}}  

--\>\> problem starts from here:  
if issue priority is critical -\> {{lookupissues.size}} for that condition only  
If issue was created within the past week -\> {{lookupissues.size}} for that condition only

etc  

What should be the action?

Thanks


author: Bill Sheboy
body: You could perform multiple calls to Lookup Issues with different JQL, saving the counts in Created Variables, and using those in the message. This may be easier to read in the rule, but will run more slowly.

Or...use one lookup with smart value, list filtering to get the issues you want from the Lookup Issues result, and that can be combined with a math expression. For example...

```
Medium count: {{#=}}0{{#lookupIssues}}{{#if(equals(priority.name,"Medium"))}}+1{{/}}{{/}}{{/}}
```

How that works:

* there is some Lookup Issues action with JQL that returned issues
* we [iterate over all of the issues](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/#Combined-function-examples) in the results

```
{{#lookupIssues}}do something{{/}}
```

* for your case, that *do something* is filtering for any issues with a priority name of "Medium"

```
{{#if(equals(priority.name,"Medium"))}}when true return this{{/}}
```

* when an issue matches, we add +1
* around that, we wrap a math expression, with a 0 default value at the front, to sum the count

To find other priority counts, change the filter value.

Similarly, the created date could be checked if it is within this week using logical functions and the date / time functions: <https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/>