Use case
In this use case we will get the assets (formerly insight objects) of a Jira Cloud issue and write the respective object labels to a custom text field.
🗒️ Prerequisites
For this use case we need a custom action for executing the get assets operation. It should be executed for a Jira Cloud instance.
Create a connection
Configure the connection either inside the post function configuration or using the Remote actions page in the Manage apps administration by setting the following input.
Name
Atlassian API
Connection type
Choose External.
Base URL
https://api.atlassian.com
Authentication
Choose Basic authentication and provide an email as the username and an API token as password.
Create an action
Create the action either inside the post function configuration or using the Remote actions page in the Manage apps administration by setting the following input.
Name
Get assets
Method
Choose GET.
Default connection
Choose Atlassian API.
REST path
/jsm/assets/workspace/{workspaceId}/v1/aql/objects?{qlQuery}
The values used below are created for the example only. Please provide real input from your instance for making the use case realistic.
Parameters
workspaceId
The workspaceId is used to identify your individual instance of Insight. It is retrieved through the following endpoint: https://SITE_NAME.atlassian.net/rest/servicedeskapi/insight/workspace.
qlQuery
The qlQuery parameter holds an AQL (Asset Query Language) expression and determines which objects should be fetched. For the sake of the example we set the issue key as ISSUE-1.
object HAVING connectedTickets(key = ISSUE-1)
⚒️ Configuration
Add the Execute remote action post function to the desired transition or create a new transition and choose the Expert mode.
Select action
Choose the previous created action which we named Get assets.
Select connection
It is automatically preselected with the default connection value of the selected action.
Update issue fields (optional)
Other default options like Response body, Response status or Set field value manually are available in any mode in the post function.
Select the field to be set.
Choose the text custom field to hold the object entry labels.
Set the value manually by using the following parser expression:
%{action.response.objectEntries[*].label}
This parser expression uses the field code Action response details and JMESPath in order to get the information from the response.