Automation For Jira - Writing a rule that sends daily emails about JSM backlog
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This article describes how to create an Automation Rule using the Lookup Issues and Create Variable actions (available in Automation for Jira from the version 9.0.1), which will send an email including various lists of issues from a Service Management project, allowing managers to monitor the health of the queues.
The automation rule provided in this article will generate the lists below:
- List of open issues
- List of unassigned issues
- List of issues waiting on the customer side
- List of issues waiting on the support side
Environment
- Jira Service Management (JSM) Data Center Only (This article does not apply to Server licenses)
- Applicable JSM / A4J (Automation for Jira) versions:
- JSM 5.11.0 and any higher version (this JSM version ships with A4J 9.0.1)
- OR JSM 4.20.0 and any higher version, in combination with A4J 9.0.1
Solution
Rule configuration details
The rule will need to be configured as follows:
- Add the Scheduled trigger with the settings below:
- Frequency: Once per day
- Select the option simply run the conditions and actions without providing issues
Add the Lookup Issues action, with the JQL query below ( Replace <JSM_PROJECT_KEY> with the key of the JSM project):
project = <JSM_PROJECT_KEY> AND resolution = Unresolved ORDER BY "Time to resolution" ASC
- Add the Create Variable action, with the parameters below
- Variable name: OpenedIssues
Smart value:
{{#lookupIssues}}<tr><td><a href="{{url}}">{{key}}</a></td><td><a href="{{url}}">{{summary}}</a></td><td><em>{{assignee.displayName}}</em></td></tr>{{/}}
Add the Lookup Issues action, with the JQL query below ( Replace <JSM_PROJECT_KEY> with the key of the JSM project):
project = <JSM_PROJECT_KEY> AND assignee is EMPTY AND resolution = Unresolved ORDER BY "Time to resolution" ASC
- Add the Create Variable action, with the parameters below
- Variable name: UnassignedIssues
Smart value:
{{#lookupIssues}}<tr><td><a href="{{url}}">{{key}}</a></td><td><a href="{{url}}">{{summary}}</a></td><td><em>{{assignee.displayName}}</em></td></tr>{{/}}
Add the Lookup Issues action, with the JQL query below ( Replace <JSM_PROJECT_KEY> with the key of the JSM project):
project = <JSM_PROJECT_KEY> AND status = "Waiting for support" AND resolution = Unresolved ORDER BY "Time to resolution" ASC
- Add the Create Variable action, with the parameters below
- Variable name: IssuesWaitingForSupport
Smart value:
{{#lookupIssues}}<tr><td><a href="{{url}}">{{key}}</a></td><td><a href="{{url}}">{{summary}}</a></td><td><em>{{assignee.displayName}}</em></td></tr>{{/}}
Add the Lookup Issues action, with the JQL query below ( Replace <JSM_PROJECT_KEY> with the key of the JSM project):
project = <JSM_PROJECT_KEY> AND status = "Waiting for customer" AND resolution = Unresolved ORDER BY "Time to resolution" ASC
- Add the Create Variable action, with the parameters below
- Variable name: IssuesWaitingForCustomer
Smart value:
{{#lookupIssues}}<tr><td><a href="{{url}}">{{key}}</a></td><td><a href="{{url}}">{{summary}}</a></td><td><em>{{assignee.displayName}}</em></td></tr>{{/}}
- Add the Send Email action, with the parameters below:
- In More Options, untick the option Convert line breaks to HTML line breaks
- To: choose the recipient(s) of your choice (groups of users, email addresses...)
Subject:
JSM project - Daily report
Content:
<h2>JSM project - Daily report</h2> <h3>Open issues</h3> <table border="0" cellspacing="0" cellpadding="2"> <thead> <tr> <th align= "left">Key</th> <th align= "left">Summary</th> <th align= "left">Assignee</th> </tr> </thead> <tbody> {{OpenedIssues}} </tbody> </table> <h3>Unassigned issues</h3> <table border="0" cellspacing="0" cellpadding="2"> <thead> <tr> <th align= "left">Key</th> <th align= "left">Summary</th> <th align= "left">Assignee</th> </tr> </thead> <tbody> {{UnassignedIssues}} </tbody> </table> <h3>Issues waiting on the support side</h3> <table border="0" cellspacing="0" cellpadding="2"> <thead> <tr> <th align= "left">Key</th> <th align= "left">Summary</th> <th align= "left">Assignee</th> </tr> </thead> <tbody> {{IssuesWaitingForSupport}} </tbody> </table> <h3>Issues waiting on the customer side</h3> <table border="0" cellspacing="0" cellpadding="2"> <thead> <tr> <th align= "left">Key</th> <th align= "left">Summary</th> <th align= "left">Assignee</th> </tr> </thead> <tbody> {{IssuesWaitingForCustomer}} </tbody> </table>
- In More Options, untick the option Convert line breaks to HTML line breaks