<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=299788&amp;fmt=gif">

Jira Service Desk Cloud Pro Tip—Automatically Add New Approvers without Overwriting Existing Ones

Atlassian Cloud, Jira Service Desk

Untitled-012-1

Having worked with ITSM teams all over the country, I've seen my fair share of Jira Service Desk's approval feature put to good use. Change control and access request approvals are very common, as well as purchases and time-off requests. No matter the approval at hand, there are certainly cases where it may be appropriate to invite more people to the approval party without kicking anyone else out.

To put it in JSD config terms, "For some approval scenarios it is appropriate to create automation rules to append people to the approver field."

Here's a quick how-to using the newly updated automation functionality (formerly Automation for Jira) in Jira Service Desk Cloud:

 

You Gotta Get All Up In Those AccountIDs

There's no way around it. You need to get the accountId for each of the people you wish to append in the approver field. It's kind of drag to have to do that, but it's just the world we live in these days, and according to Atlassian, there's no looking back. It does cause one to question the maintainability of such a configuration, but the alternatives are bleak, to put it nicely. Update the approver field manually, write my own custom script, or create my own plugin? No thanks!

 

How to Get AccountIDs

You can request that the system administrator download a CSV file of all their users, and said file will include AccountIds. Sometimes you just need IDs for a couple of peeps, so the download is a bit much. In that case, you can grab the AccountId from the URL when viewing the user's profile, as seen below. You can also get it through the Jira API by using the following URL: <myurl>.atlassian.net/rest/api/3/user/sarch?query=<email> (be sure to replace <myurl> and <email> with the appropriate text for your site and user)

 

Screen Shot 2020-04-30 at 4.29.56 PM

Screen Shot 2020-04-30 at 4.30.15 PM-2

 

Create/Edit Your Automation Rule

I'm assuming that if you're reading this article, this isn't the first rule you've set up. But if it is, all good. No worries, mate. You may want to get familiar with creating rules and also, good on you for taking the bull by the horns like that! 

The example in the screenshot below includes some if/then logic to append a specific set of users depending on the value of a particular custom field (i.e. the Finance System has a different set of folks for approvals than the Marketing System). You'll want to set up your rule's trigger and conditions to fit your specific use case (i.e. on transition to the Production Approval status, add John, Paul, George, and Ringo as approvers).

The append user magic, however, happens in the Edit Issue portion of the rule. After you click the Edit Issue action to your rule, click on "More options" and pop in your JSON (see example JSON below), and you're good to go. DO NOT select a value in the "Choose field to set" dropdown, it just won't work.

 

Screen Shot 2020-04-30 at 2.19.32 PM-2

 

Example JSON

You can copy and paste this JSON into your automation rule, just be sure to update the custom field ID and the user accountIds to be the ones that are specific to your site/users.

  "update": {
    "customfield_10155": [{
      "add": { "accountId": "5cefed75f34cf123456" }
    },{
      "add": { "accountId": "5dc2e93828be123456b" }
    },
      "add": { "accountId": "5dc2f9c8dfca123456" }
    },{
      "add": { "accountId": "5d9c92123456" }
    }]
  }
}

If you don't need to append four users, as is the case in this example, simply remove the portion of the JSON that includes ,{"add".... through to .... 456" }


Happy Automating!

 

Managing JIRA at Scale White Paper

TAGS: Atlassian Cloud, Jira Service Desk

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Subscribe to Our Newsletter

Recent Blog Posts