How to use the Approval Completed trigger with workflows that have multiple approval steps?

Still need help?

The Atlassian Community is here for you.

Ask the community


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

Summary

The Approval completed trigger is only available for Jira Service Management and it is executed when an approval step on an issue is accepted or declined.

For workflows that contain more than one approval step, rules with this trigger will be executed repeatedly after each approval step. In this page we describe how you can use smart values to ensure the rule only executes after the appropriate approval steps instead of all of them.

Reference Information

Scenario

Let's consider a Jira Service Management Project that has two levels of approvals (each one requires single approval):

  • Initial Validation - First Approval Step
  • Secondary Approval - Determined depending on the issue characteristics

To support the above scenario we have two custom fields to determine the approver of each step - Approver 1 and Approval 2 - both single user fields, in this example we will set the following behavior:

  1. Approver 1 will be set by default, more on how to do that can be found on this page.
  2. Upon ticket creation Approver 1 will be set as Assignee - using automation.
  3. Approval 2 will be set based on the value of a custom field named Total Credit Amount - using automation
  4. Once the first approval is completed Approval 2 will be set as Assignee - using automation
  5. Once the the second approval is completed the ticket will go back to Unassigned - using automation

Sample Workflow:

Issue Created Automation

Once the issues are created we will have two automation triggered, in this example:

  • Field Approver 1  = customfield_10111
  • Field Approval 2  = customfield_10112

To find the custom field IDs in your environment, please use this reference page: How to find id for custom field(s)?

Setting the Approver 1 as Assignee

  • Issue created trigger
  • Assign issue action
    • Assign issue to = Smart value
    • User = {{customfield_10111.accountId}}


Determining Second Approval

  • Issue created trigger
  • If/Else condition - to validate the appropriate approver
  • Edit issue actions
    • Pick the Approval 2 field from the drop down and select the user

Approval Completed Automation

  • If the first approval is completed, assign the issue to the second approver
  • If second approval is completed, set issue to unassigned

Set the rule as:

  • Approval Completed trigger
  • Add Advanced Compare condition as
    • First value = {{approval.approver}}
    • Condition = equals
    • Second value = {{customfield_10111.accountId}}
  • Assign issue action
    • Assign the issue to = Smart value
    • User = {{customfield_10112.accountId }}
  • Add Advanced Compare condition as
    • First value = {{approval.approver}}
    • Condition = equals
    • Second value = {{customfield_10112.accountId}}
  • Assign issue action
    • Assign the issue to = Specify user
    • User = Unassigned



Note: The above are examples of how the smart values can be used to accomplish different behaviors for specific approvals, the rules above can be changed and adapted to accommodate the specific needs of your environment.



Last modified on Jan 8, 2024

Was this helpful?

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