Jira Service Management Cloud | Use Automation Rule to Notify Pending Approvers

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Summary

Sometimes, when there is an approval step configured in the workflows, it would be helpful to notify the pending approver to decide so the ticket flow can go to the next step; however, at the moment, there is no notification that can be configured that could remind those that are selected to be an Approver of a request. The primary workaround is to get the approvers' approval decision and then use the Comment action in the automation rule to "@" mention the pending approvers so they will be notified that only their approval is pending the final decision.

This article will show the associated feature suggestion and provide an example workaround for the suggested function.

Associated feature suggestion

The following feature suggestion has been raised for the implementation and improvement of the "Approval required" automation rule action in JSM:

Workaround: Use automation rule to notify the pending approvers

The suggested automation rule logic is to search for tickets with the final approval decision as "pending" due to one or more approvers not having made their decision yet, then comment on the ticket to "@" notify the user pending the approval.

Case 01: Using a User Picker field

The example rule below is in a scenario where two approvers are in the selected approver field.

  • When: Scheduled
  • Mark the "Run a JQL search and execute actions for each issue in the query" checkbox and filter for the issues with pending approvals:
"Approvals[Approvals]" = pending() AND --complete your JQL filter here (I.E. project = PROJECTKEY AND status = "Waiting for Approval")
  • Then: Re-fetch issue data
  • Add a condition: IF or ELSE block
    • If: All matches
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(0)}} 
      • Condition: contains
      • Second value: approved
    • AND
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(1)}} 
      • Condition: contains
      • Second value: pending
    • Then: Add comment to issue
      • Comment:
        • "Approver: {{issue.customfield_ID.approvers.get(0).approver.get(0).displayName}} has approved the issue. Ticket is now waiting for the Approver: [~accountid:{{issue.customfield_ID.approvers.get(0).approver.get(1).accountId}}] decision."
    • Else If: All matches
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(0)}} 
      • Condition: contains
      • Second value: pending
    • AND
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(1)}} 
      • Condition: contains
      • Second value: approved
    • Then: Add comment to issue
      • Comment:
        • "Approver: {{issue.customfield_ID.approvers.get(0).approver.get(1).displayName}} has approved the issue. Ticket is now waiting for the Approver: [~accountid:{{issue.customfield_ID.approvers.get(0).approver.get(0).accountId}}] decision."
  • Name the automation rule and turn it ON.
  • Below is a quick exemple of how the automation rule logic should work:

Case 02: Using a Group Picker field

The example rule below is in a scenario where an approver group field is selected as the approver source.

  • When: Scheduled
  • Mark the "Run a JQL search and execute actions for each issue in the query" checkbox and filter for the issues with pending approvals:
"Approvals[Approvals]" = pending() AND --complete your JQL filter here (I.E. project = PROJECTKEY AND status = "Waiting for Approval")
  • Then: Re-fetch issue data
  • Add a condition: IF or ELSE block
    • If: All matches
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(0)}} 
      • Condition: contains
      • Second value: approved
    • AND
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(1)}} 
      • Condition: contains
      • Second value: pending
    • AND
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(2)}} 
      • Condition: contains
      • Second value: pending
    • Then: Add comment to issue
      • Comment:
        • "Approver: {{issue.customfield_ID.approvers.get(0).approver.get(0).displayName}} has approved the issue. Ticket is now waiting for the Approvers: [~accountid:{{issue.customfield_ID.approvers.get(0).approver.get(1).accountId}}] and [~accountid:{{issue.customfield_ID.approvers.get(0).approver.get(2).accountId}}] decision."
    • Else If: All matches
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(0)}} 
      • Condition: contains
      • Second value: pending
    • AND
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(1)}} 
      • Condition: contains
      • Second value: approved
    • AND
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(2)}} 
      • Condition: contains
      • Second value: pending
    • Then: Add comment to issue
      • Comment:
        • "Approver: {{issue.customfield_ID.approvers.get(0).approver.get(1).displayName}} has approved the issue. Ticket is now waiting for the Approver: [~accountid:{{issue.customfield_ID.approvers.get(0).approver.get(0).accountId}}] and [~accountid:{{issue.customfield_ID.approvers.get(0).approver.get(2).accountId}}] decision."
  • Else If: All matches
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(0)}} 
      • Condition: contains
      • Second value: pending
    • AND
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(1)}} 
      • Condition: contains
      • Second value: pending
    • AND
      • First value:

        {{issue.customfield_ID.approvers.get(0).approverDecision.get(2)}} 
      • Condition: contains
      • Second value: approved
  • Then: Add comment to issue
    • Comment:
      • "Approver: {{issue.customfield_ID.approvers.get(0).approver.get(2).displayName}} has approved the issue. Ticket is now waiting for the Approver: [~accountid:{{issue.customfield_ID.approvers.get(0).approver.get(0).accountId}}] and [~accountid:{{issue.customfield_ID.approvers.get(0).approver.get(1).accountId}}] decision."
  • Name the automation rule and turn it ON.
  • Below is a quick exemple of how the automation rule logic should work:


Automation Tips

Please keep in mind that you must find the smart value of the custom field configured in the "Approver source" section at your approval step workflow setting so you can replace on the customfield_ID variable. In the exemple below the custom field is the "Approvers" field.

You can find it by following the steps on our article here: Find all available smart values for a Jira issue.

References

Last modified on Oct 22, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.