Create Asset

This feature is currently in Beta. If you have any feedback for us, please add a comment to SRJIRA-6849.

We’ve provided an easy way to create Insight/Asset objects in Automation for Jira. For example, you can use the Create Asset 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 action, you can reference attributes of the Assets object in another action using the {{createdObject}} smart value (see step 10 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}}

Obtaining attributes

If you wish to discover more attributes, you can add Log action to a rule that contains the Create Asset 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.

The following example uses attributes and objects from the Sample IT Asset Schema template. If you are using your own schema, make sure you replace any mentioned names with those that match your own objects and attributes.

  1. In Automation for Jira, select Create rule.

  2. Select Issue created as the trigger. 
  3. Select Save.
  4. Select New action

  5. Scroll to Miscellaneous and select Create Asset.

  6. Enter the object type and any attribute values, in JSON format, into the Attributes text box. In addition, if you use values from the current issue, make sure you use the JSON-escaping functions for smart values.

    Examples are provided for you below the Attributes text box. 


  7. Select Save.
  8. Select New action
  9. Under Issue actions, select Comment on issue.

  10. Enter a comment for this issue and use the {{createdObject}} smart value to reference an attribute of the created object. In this example, we want to create a comment that links to the created object, so we enter the following:

    A new object has been created ({{createdObject.objectKey}}): * {{baseUrl}}/secure/ObjectSchema.jspa?typeId={{createdObject.objectTypeId}}&objectId={{createdObject.id}}
  11. Select Save.
  12. Name the automation and select Turn it on. In this example we name the automation Create Object Rule.

    An Assets object will now be created every time a new issue is created.


Related content

On this page