How to auto-populate the Assets object field based on the "Reporter" field of the ticket using automation

Still need help?

The Atlassian Community is here for you.

Ask the community


 

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

   

Summary

Refer to the below example to understand how to auto-populate the Assets object field based on the "Reporter" field of the ticket. 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

Environment

 Automation for Jira and Jira Service Management Assets

Solution

To populate the Assets object custom field based on the "Reporter" of the ticket, you need to configure an Automation rule, where you can use the Edit Issue action to achieve your use case by using an AQL query such as:

"<user-type-attribute-name>" = {{reporter}}

First, we need to set up a "User" type attribute on your Assets object:

  1. Select Assets in the top navigation bar.

  2. Select the relevant object schema.

  3. Select the relevant object type.

  4. Select Attributes.

  5. Add a new attribute with the type "User". In the example below, this attribute will be called "Owner".

Now you should be able to link users to this attribute like in the image below. You'll be able to link both Atlassian accounts and portal-only accounts.

(info) For this automation to work, the "User" type attribute created above must be populated with the reporter's account. 

After setting up the object type attribute and the Assets object field, create an automation rule as follows:

  1. Go to Project Settings > Automation;
  2. Click on Create Rule;
  3. Create a rule with the following structure:
    • Trigger: Issue Created
    • Action: Edit Issue
      • Select the Assets Object Field that is used to display objects assigned to users.
      • Set it up with the IQL below, but replace 'Owner' with the name of the attribute you created previously:

        "Owner" = "{{reporter.accountID}}"
        

    • Save and publish the automation rule.

After publishing the rule, the Assets object field will be automatically populated with the assets assigned to the reporter of the ticket right on ticket creation.

Note

Due to the following bug, values that would otherwise identify a reporter such as currentUser(), currentReporter() and {{reporter.displayName}} will not work with the automation rule:

JSDCLOUD-12165 - Getting issue details... STATUS



Last modified on Mar 20, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.