Create Assets Objects and Populate Custom fields based on Reporter in JSM Cloud
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
Learn how to create Assets objects, auto-populate user type attributes based on the "Reporter" and set it to an Asset Object Custom field in Jira Service Management Cloud.
Solution
The solution requires an automation to be created. The automation structure should be as follows:
Prerequisites: You will need an object type with at least one user attribute type and an assets object custom field configured to use the same object type and associated with the request type.
The AQL items highlighted in this example "User" objectType and "Jira User" attribute must be replaced according to your object type name and user attribute.
Please note that the Atribute Name value must be used, not the Display name as detailed on How to use Assets Query Language (AQL). You may verify this directly at the Object Type attribute settings.
Following our example, the attribute Name value is jira_user.
The automation trigger should be Work item created so that it executes whenever a new work item is submitted.
Next, a Lookup objects action is required to search for existing objects based on the submitter's account ID to avoid duplicates. The Assets Query Language (AQL) search can be like:
objecttype = "User" AND jira_user = {{reporter.accountld}}Create an IF/Else condition with the lookup objects action's results. In case an object already exists for the work item's submitters, we don't want to proceed and create a duplicate object, so the condition must check:
{{reporter.accountId}} equals {{lookupObjects.jira_user}}.Another possible possible condition is
{{lookupObjects.size}} > 0, since presenting any results means we have match.
If the above condition matches, an object already exists for the work item's reporter and we can add it to the Asset Object Custom field on the IF block:
Add a new Edit work item and set the Assets object field using the AQL
jira_user = {{reporter.accountld}}
If the above condition does not match, a new object must be created for the work item's reporter within the IF/ELSE block:
Add a Create object. Within this step we specifically require that the attribute Jira User is set with
{{reporter.accountid}}, you may populate the other object attributes using the reporter smart values.Add a short Delay Action (3-5s) to allow the asset object creation to complete.
Add a new Edit work item and set the Assets object field using the AQL
jira_user = {{reporter.accountld}}
Verify the Automation
To verify it works, create a test ticket and confirm that the Assets object field is populated with the reporter's assigned objects (check the audit log if it's empty — the User attribute isn't usually populated for that reporter).
For more examples about fetching Asset objects based on single or multi-user type custom fields or vice versa, refer to this article: Auto-populate approvers from Asset objects attributes.
Was this helpful?