Lookup Asset (Insight) Objects from AQL (IQL)
We've provided an easy way to look up/retrieve Insight/Asset objects from AQL/IQL in Automation for Jira. You can use this action to retrieve any Assets object and/or attributes from any object schema. Once you have added the Lookup Asset (Insight) object from AQL (IQL) with ScriptRunner action, you can then reference components of the Assets object in another action using the {{lookupAssets}}smart value.
For example, if you want to make all Host objects' attributes available to use in later actions, you could use the following AQL query in the Lookup Asset (Insight) object from AQL (IQL) with ScriptRunner action:
objectType = HostIf you wish to discover more attributes, you can add Log action to a rule that contains the Lookup Asset (Insight) object from AQL (IQL) with ScriptRunner action— {{lookupAssets}} 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.
In subsequent actions, you can then access the Host objects' attributes using {{lookupAssets}}. Please take a look below for detailed examples.
Example: Set the description of an issue to a list of object keys
In the following example, we want to retrieve all Host objects so we can list the object keys and names in the description of new issues.
If you wish, you can improve your rule further by adding conditions.
Example: Working with multi-select Assets custom fields
If a user selects objects in an Assets multi-select custom field, it would be useful if attributes of the objects selected could be posted elsewhere on an issue. With this action you can list multiple Assets object attributes.
In the following example, we want the name and serial number number of each computer selected in the Computers Assets custom field to be posted as a comment on the issue.
Computers, or equivalent.If you wish, you can improve your rule further by adding conditions. For example, you may want to add a condition to the rule so it does not execute if the Computers Assets custom field has no value.