Asset Object Created Trigger
This feature is currently in Beta. If you have any feedback for us, please add a comment to SRJIRA-6850.
You can use the Asset Object Created trigger to create a rule that runs whenever an Assets object is created. You can also use the associated {{createdObject}}
smart value to apply conditions to the rule and input the created object's information elsewhere, for example, into an email or a comment (see step 15 in the example below for a working example of how to use this smart value).
There are many things you can do with this trigger. For example, you could use the Create Issue action to create a Task every time a new object is created.
If you want to trigger this rule conditionally, use the Advanced compare condition with the {{createdObject}}
smart value, and be careful not to add trailing spaces. 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 Asset Object created trigger—{{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, if you want to create a Task with the same name as the created object you can use {{createdObject.attributes.Name}}
.
Scope
The Asset Object created trigger is a Global trigger, which means a rule with this trigger is applied to all projects and can only be managed by Jira Administrators.
Example: Create a Task when a new License object is created
In the following example, we want a new Task to be created when a new License object is created. In this example, the purpose of the Task is to assign the new License to a user.
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.
- In Automation for Jira, select Create rule.
- Select Asset Object created as the trigger.
- Select Save.
- Select New condition.
- Select Advanced compare condition.
- Enter
{{createdObject.objectType.name}}
for the first value. - Make sure the equals condition is selected.
- Enter
License
for the second value. - Select Save.
- Select New action.
- Select Create issue.
- Select the project you want to apply the rule to. In this example we choose our
Jira Testing Project (JRA)
. - Select the Task issue type.
- Enter
New License Created: {{createdObject.attributes.Name}}
in the Summary field. Enter the following into the Description field:
The following description uses smart values to display the object key, the license key, and a link to the new object.
A new License object has been created ({{createdObject.objectKey}}): * License key: {{createdObject.attributes.License Key}} * Link: {{baseUrl}}/secure/ObjectSchema.jspa?typeId={{createdObject.objectTypeId}}&objectId={{createdObject.id}} This key must be assigned to a user.
Select Save.
You could add more options to this action to improve the created issue. For example, you could add the user who typically manages your licenses as an Assignee.
- Name the automation and select Turn it on. In this example we name the automation
New License Rule
.
A new Task will now be created every time a new License object is created.