Update the Approver groups field with Automation in JSM Cloud
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
By default, your IT service management (ITSM) service project includes an Approvers field for adding individual approvers and an Approver groups field for adding approver groups. Also, if desired, you can create your own custom fields for approvals.
In this article, we'll focus on how to update the Approver groups field using an Automation rule.
Solution
Updating Approver groups via Automation is two steps: (1) get the groups groupId from admin.atlassian.com, then (2) set them in an Edit work item action using the JSON payload below. The groupId (not the group name) is what the field requires.
Get group ID to use in Automation rule
Visit admin.atlassian.com
Depending on your user management experience, navigate to the Groups page
Select the required Group
Copy the groupId from the URL, which comes after
/groups/
For example: https://admin.atlassian.com/o/<org_id>/groups/<group_id>
This ID will be used in the next step, which is building the automation rule.
Update the Approver groups field through Automation
In the Service Project, go to Project Settings → Automation
Select Create rule
Set the trigger as Work item created
Add an Edit work item action
Select More actions > Additional fields
Add the following JSON to the Additional fields section
Replace the Group name and Group ID based on the previous step
{ "update": { "Approver groups": [ { "add": { "name": "[REPLACE WITH NAME OF THE APPROVER GROUP]", "groupId": "[REPLACE WITH groupId]", "self": "https://[REPLACE WITH SITE NAME].atlassian.net/rest/api/3/group?groupId=[REPLACE WITH groupId]" } } ] } }
For example, imagine you have a site called mysite.atlassian.com and a group named "Example group" with ID 23789204-e4aa-4a60-965c-59c651914932.
In that case, the JSON will look like the following:
{
"update": {
"Approver groups": [
{
"add": {
"name": "Example group",
"groupId": "23789204-e4aa-4a60-965c-59c651914932",
"self": "https://mysite.atlassian.net/rest/api/3/group?groupId=23789204-e4aa-4a60-965c-59c651914932"
}
}
]
}
}Note: if you have created your own custom fields for approvals related to Groups you would simply need to replace the "Approver groups" field in the payload above to your own custom field information (e.g. customfield_13241).
To get the custom field ID, please refer to our article on the topic.
To confirm it's working, create a test work item and verify that the Approver groups field is populated with the expected group (check the audit log if not).
Was this helpful?