How to update Assets custom field via an Automation rule in Jira Service Management
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
In the Jira Service Management cloud there may be a requirement to update an Assets custom field via an automation rule.
Environment
Jira Service Management cloud environment.
Solution
Requirement 1: When you know the object ID to be updated.
The following image shows how to update the assets custom field via an automation rule. For simplicity, I have selected the manual trigger. But based on your requirements you can select the trigger as you wish.
{
"fields": {
"customfield_11758": [
{
"id": "af747313-53f2-461b-9db1-6b24f094fba2:2520"
}
]
}
}
Requirement 2: When you want to lookup the objects in Assets schema and use the return object to update in assets custom field.
Here, it is doing the lookup objects action in early of the automation rule and then return an object. Then we can pass object ID as {{lookupObjects.id}} in to the JSON content as follows.
Workspace ID
The Jira Service Management REST API uses the workspaceId
to identify your individual instance of Assets. You must include the workspaceId
to make the calls via automation rule.
Use the following endpoint to find your workspaceId
:
https://<JSM Premium Site Name>.atlassian.net/rest/servicedeskapi/assets/workspace
Object ID
You can get the object id via Assets UI or the REST API command.
https://developer.atlassian.com/cloud/assets/rest/api-group-object/#api-group-object