Create Asset
We've provided an easy way to create Insight/Asset objects in Automation for Jira. For example, you can use the Create Asset with ScriptRunner action to create a new Assets object when a new issue is created.
When you use this action, make sure you specify object type and attributes in JSON format.
Once you have added the Create Asset with ScriptRunner action, you can reference attributes of the Assets object in another action using the {{createdObject}}smart value (see step ten in the example below for a working example of how to use this smart value).
Using {{createdObject}} you can retrieve the attribute values, in addition to other important object values. For example:
{{createdObject.objectKey}}
{{createdObject.id}}
{{createdObject.attributes.Name}}
{{createdObject.objectType.name}}If you wish to discover more attributes, you can add Log action to a rule that contains the Create Asset with ScriptRunner action— {{createdObject}} must be added as the value in the Log action. Once the rule has run, you can check the audit log and it will display available attributes for you to use.
Retrieving object attributes using smart values is helpful in many contexts. For example, you can add a comment that links to the created object, as shown in the example below.
Example: Create Assets objects on issue creation and add a comment
In the following example, we want an Assets object to be created when a new issue is created. In addition, we want a comment to be added to the issue that links to the created object.