How to automatically update Jira Service Management Approvals when Assets approvers change

Still need help?

The Atlassian Community is here for you.

Ask the community

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

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

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
  • 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

  1. Create a Text field (single line) custom field called Approvers reset
  2. 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
  3. Visit Jira Admin -> System -> Automation rules
  4. 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
  5. Save and publish the rule
  6. 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
  7. Save and publish the rule
  8. Visit your project, click Project Settings and click Legacy Automation
  9. 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
  10. Save the rule


Solution illustrations

These screenshots illustrate the desired configuration

Workflow

Rule 1


Rule 2

Rule 3





Last modified on Jan 22, 2025

Was this helpful?

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