Asset Object Updated 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 updated with ScriptRunner trigger to create a rule that runs whenever an Assets object is updated. You can also use the associated {{updatedObject}} smart value to apply conditions to the rule and input the updated object's information elsewhere, for example, into an email or a comment (see step 14 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 Send email action and ensure an email is sent to a specific user every time an object is updated.

If you want to trigger this rule conditionally, use the Advanced compare condition with the {{updatedObject}} smart value, and be careful not to add trailing spaces. Using {{updatedObject}} you can retrieve the attribute values, in addition to other important object values. For example: 

{{updatedObject.objectKey}} {{updatedObject.id}} {{updatedObject.attributes.Name}} {{updatedObject.objectType.name}}

Obtaining attributes

If you wish to discover more attributes, you can add Log action to a rule that contains the Asset Object updated with ScriptRunner trigger—{{updatedObject}} 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 only want an email sent when the object updated is a specific object type, you can use {{updatedObject.objectType.name}}, and enter the object type you want to match.

Scope

The Asset Object updated with ScriptRunner 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: Send an email when an object is updated

In the following example, we want an email to be sent to a specific user if any License object has been updated. We want the user to be notified of the change so they can check whether it is valid and decide if they want to take action.

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 Asset Object updated with ScriptRunner as the trigger.

  3. Select Save.
  4. Select New condition.
  5. Select Advanced compare condition.
  6. Enter {{updatedObject.objectType.name}} for the first value.
  7. Make sure the equals condition is selected. 
  8. Enter License for the second value. 
  9. Select Save.
  10. Select New action
  11. Select Send email
  12. Choose who the email will be sent to. In this example we select jira-administrators.
  13. Enter a Subject for the email. In this example we enter Object {{updatedObject.objectKey}} was just updated
  14. Enter the following into the Content field:

    The following description uses smart values to display the object key, the object name, and a link to the new object. 

    The following object was just updated: * Object Key: {{updatedObject.objectKey}} * Object Name: {{updatedObject.attributes.Name}} * Link: {{baseUrl}}/secure/ObjectSchema.jspa?typeId={{updatedObject.objectTypeId}}&objectId={{updatedObject.id}} You must check the change history of the object to make sure the change is valid and decide if you need to take any action.
  15. Select Save.
  16. Name the automation and select Turn it on. In this example we name the automation Updated License Rule.

    An email is now sent to Jira administrators every time a License object is updated.



Related content

On this page