How to automatically update Jira Service Management Approvals when Assets approvers change
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs 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
There is a bug in Jira Service Management (JSM) that occurs when the Approvals feature is set to use users from an Assets custom field.
JSDSERVER-12730 - Approvers from Assets customfield should be updated when Object is replaced
Due to the bug, when someone changes the users via the designated approvers field on a Jira Issue, the approvers list does not automatically updated after it's initial population.
This means that once an approver is selected via the Assets custom field, the approvals list won't get updated again with subsequent updates to the approval field
This knowledge base article describes a solution to workaround this issue using Automation (legacy) and Automation rules (Automation for Jira)
Environment
You have JSM Approvals configured using an Assets custom field for the approvers list
and
You are affected by JSDSERVER-12730 - Approvers from Assets customfield should be updated when Object is replaced
and
You have Automation for Jira installed (included with Jira Data Center at no additional cost)
Solution
Theory of operation
The bug JSDSERVER-12730 - Approvers from Assets customfield should be updated when Object is replaced causes the JSM Approver list to only get populated initially, not for subsequent changes, when the approvals system is set to use an Assets custom field.
An approvals round is stopped when the issue is transitioned to the status defined in the Approval workflow step under "Transition when declined". It is started, and the approvers list being populated from the defined field, when the issue is subsequently transitioned to the "Needs Approval" workflow step.
This means that detecting a change to the Assets approvers field using automation, automatically declining the approval, then transitioning back to the initial "Needs Approval" step is a possible workaround. Due to various limitation in both JSM Automation and Automation for Jira, 3 automation rules are required.
Rule 1 - Automation for Jira
This rule detects changes to the Assets Approvers custom field
It comments on the issue, so that JSM Legacy automation can detect the change
Since the solution requires Denying the approval, it also sets a special custom field created especially for this workaround, so that it knows the denial was part of this automation, rather than a regular user performing the Denial
Rule 2 - JSM (Legacy) Automation
This rule is required as Automation for Jira cannot transition issues when that status has an Approvals Approved or Denied action applied to it (JIRAAUTOSERVER-372 - Add the ability to automatically approve or decline requests using a rule from Automation for Jira)
This rule checks for the comment added by Rule 1, and then Declines the transition when found
Rule 3 - Automation for Jira
When the issue is transitioned to the Denied status (performed by rule 2), and the special custom field is set, it transitions the issue back to the "Waiting for Approval" status. This results in the Approvals list being reinitialised from the Assets custom field
It also resets the special custom field so that the process could be initiated again for this issue
Implementing the solution
Create a Text field (single line) custom field called Approvers reset
In your project's workflow, ensure that the "Waiting for approval" step can be transitioned to "Denied", and visa versa. You may need to add or update an existing transition to make this possible
Visit Jira Admin -> System -> Automation rules
Create a rule:
Name:Update Approvers Part 1
Trigger (when) : Field Value Changed
Fields to monitor: Type the exact name of your Assets approvers custom field. You will need to type these exactly as it won't populate in dropdown
For: Edit issue
Action (then): Comment on issue
Comment: This issue was reset to the start as it's approvers were changed
Action (then): Edit Issue
Field: Approvers Reset
Value: Resetting
Save and publish the rule
Create another rule:
Name:Update Approvers Part 3
Trigger (when) : Issue transitioned
From: Status: Waiting for Approval
To: Status: Declined
Condition(if) : Issue fields condition
Field: Approvers reset
Equals Value: Resetting
Then: Transition issue
Destination Status: Waiting for approval
Field Approvers Reset
Value: Blank - This field will be cleared
Save and publish the rule
Visit your project, click Project Settings, and click Legacy Automation
Add a new rule
Name: Update Approvers Part 2
When: Comment Added
If: Comment contains:
This issue was reset to the start as it's approvers were changed
Then: Auto-approve/decline
Answer: Decline
Save the rule
Solution illustrations
These screenshots illustrate the desired configuration
Workflow


Rule 1



Rule 2

Rule 3



Was this helpful?