Automate Object Status Updates to Expired in Jira Assets Cloud
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
Learn how to periodically check and update object statuses to "Expired" using automation in Jira Assets, to accomplish this, the following Flow will be used:
Trigger | Scheduled Automation |
Lookup | Lookup Objects with AQL for overdue objects that are not already Expired |
Guard | Continue only when |
Branch | Iterate over the returned object keys |
Update | Send the documented web request for each object to update its status attribute |
Solution
Assume there is a License object type with a Status attribute indicating if the license is active or expired, and an Expiry date attribute.
From the Global admin page of automation, create a Flow with a scheduled trigger.
Add a lookupobjects action to find the objects with an overdue expiry date that are already not marked as Expired.
Lookup Objects can fetch at most 500 objects at a time. Set the schedule often enough for the expected daily expiry volume, or use the separate web-request approach described by the source when the rule must handle more than the Lookup Objects limit. Do not assume one execution processes an unlimited number of objects.
objecttype = License AND "Expiry date" < now() AND "Status" != ExpiredAdd an If block with an Advanced compare condition that the lookupobject size must be greater than 0.
{{lookupObjects.size}}Add Advanced branching within the If block to start branching over each object key in the lookupobject list. Create a variable ObjectList that stores the smart value of lookupobjects.
Within the branch, add the Send web request action. Utilize this action to edit the object attribute via JSM Assets REST API:
In the Authorization header supply the Basic Authentication token
In the URL section, add the below endpoint with your <WorkspaceId>, to obtain this value, use Get assets workspaces API Endpoint.
Use the {{ObjectList.key}} smart value to replace the <objectId>, so that we send the REST API for each object id in the ObjectList:
https://api.atlassian.com/jsm/assets/workspace/<WorkspaceID>/v1/object/<objectId>
Verify the Automation
Test with no overdue objects and confirm the count guard prevents unnecessary web request execution.
Test with one overdue object and confirm its status changes to Expired.
Test with multiple overdue objects and confirm the branch processes each returned object key.
Confirm the flow behavior when more than 500 objects are eligible.
For more examples, refer to the articles:
Was this helpful?