How to Automate reports on Assets using Object Attributes as expiring values using Automation for Assets
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
We have an In Progress Feature Request that is likely to address this: - JSDCLOUD-9930Getting issue details... STATUS
With that said, we will be configuring an Automation Rule that will send automated Reports based on Assets.
The criteria for the Reports will not be covered here, but thanks to Automation for Jira's flexibility, many configurations are possible.
The example here is just one of many possibilities.
Diagnosis
Currently, there is not a built-in way to have reporting done on Assets Objects directly based on their Attributes unless the Site is a member of the Early Access Program mentioned on the prior Feature Request.
Solution
An example Automation Rule to achieve this would be the following. We will break it down to understand what it's doing afterwards:
Trigger: Schedule
Action: Lookup Objects -> AQL in the appropriate Schema:
objectType = <object-type> AND "<DateTime-attribute>" < now(7d)
Condition: Advanced Compare:
{{lookupObjects.count}}
greater than
0
Action: Send Email -> To: <email> Body:
Key - User - Attribute - Date
{{#lookupObjects}}
* <a href="https://site.atlassian.net/jira/servicedesk/assets/object-schema/{{objectType.objectSchemaId}}?typeId={{objectType.id}}&objectId={{id}}">{{Key}}</a> - {{Name}} - ({{Attribute}} - {{Date}}
{{/}}
An Automation Rule for Reporting can be Triggered in many ways. The most useful is likely to be Scheduling the Rule to run Daily or Weekly at a given time.
The Lookup Objects Action will return objects where the AQL's conditions are met. For example, this could be looking for a Software License Expiration as the DateTime Attribute.
The Advanced Compare Condition is simply to limit emails for when there are Objects to Report on. Note that the Lookup Objects Action can only retrieve up to 50 Objects at a time. To get more than 50, the REST API will need to be used via the Send Web Request Action, but that is outside the scope of this article. Another article covers using that functionality here: How to Automate Logging of Asset Value Changes External to Assets.
Finally, the Send Email Action will send an Email to the relevant team. This could be dynamic, since the Send Email Action's To: Field can use Smart Values, such as if the Rule were Triggered by being Executed from an Issue:
{{reporter.emailAddress}}
The Body of the Email in the above rule is one way to format the information. It should produce a bulleted list of the Objects, with links to the specific Objects in Assets.
Note that the HREF link must be updated to your Site URL. Unfortunately, we have an open Bug regarding the baseUrl Smart Value and Lists in Automation: - AUTO-719Getting issue details... STATUS
This email could even be formatted into a proper HTML Table or include additional information.