Creating and linking an Asset object using Automation for Jira via REST API
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
Purpose
- Currently, the integration between Automation for Jira and Assets objects is limited in the Jira Data Center, it's not possible to use Actions to create Assets objects: JIRAAUTOSERVER-869 - Getting issue details... STATUS JIRAAUTOSERVER-464 - Getting issue details... STATUS
Requirements
- Automation For Jira
- Assets plugin
- An Assets custom field configured for linking the object with the Jira issue - Default Assets custom field
Solution
This documentation described how to use Automation for Jira (bundled with Jira 9.0+) to create and link Assets objects in Jira issues using REST API from Assets: Assets REST API documentation
Step | |||||||
---|---|---|---|---|---|---|---|
1. | Create a trigger: In this example, "Field value changed" is used to monitor the "Labels" field for "All issue operations", but other triggers can be used depending on your needs: | ||||||
2. | Create an Issue fields condition: In order to trigger the automation, create an "Issue Fields Condition". For example, execute the automation for all Jira issues with the "assets_create_object" added: | ||||||
3. | Create a Send web request action: To create an object in Assets, we'll use the "Send Web Request" action to perform a POST in the create object REST API:
| ||||||
4. | Create an Edit issue action: Select the Assets custom field which will return the object created Additional fields: Add the JSON (webhook response smart value will be used to get the object key created)
Replace the Host custom field with your Assets custom field - Assets with Jira REST API | ||||||