Auto-populate approvers from Insight objects

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 examples to automatically fetch the approvers from Insight objects when we have our assets stored in JSM Insight.

Environment

Automation for Jira and Insight JSM.

Solution

Example1: Copy a single user attribute of an object to a Jira user field
Let's assume we have an object type Employee with Manager information as a reference to itself. When one of the Employees reports an issue, you want their Manager to be added as an Approver:


  1. Trigger an automation rule when an issue is created
  2. Add a lookup object action to find the Manager of the reporter. Below IQL returns the Employee object for the reporter

    objecttype = "Employee" and "Jira user" = {{reporter.accountId}}
  3. Add an Edit action to update the Approvers field with the below smart value:

    {{lookupObjects.Manager.Jira user.accountId}}



Example2: Copy a single user attribute of an object to a Jira Insight field
Let's assume the same example as above, we have an object type Employee with Manager information as a reference to itself. When one of the Employees reports an issue, you want their Manager object to be added to an Insight custom field "Manager"

  1. Trigger an automation rule when an issue is created
  2. Add an Edit issue action to update the Manager Insight custom field:
    Below IQL returns the Manager object of Employee mentioned as Jira User:

So add the below IQL in the Edit action along with the smart value of the reporter. Because this is an Insight field, adding an IQL directly will help. There is no need to use the lookupobject action in this case:

objecttype = "Employee" and object HAVING inboundReferences("Jira user" = {{reporter.accountId}}) 



Example3: Copy multiple users from multiple objects to a Jira multi-user field
Let's assume we have an object type System with a user attribute Owners with cardinality set to unlimited. We can fetch these owners on Jira issues as approvers. The system objects on which change is scheduled are already linked to the issue via an Insight object field System object. You can fetch the Owners of the linked object to the Approvers field:

  1. Create an automation rule that triggers when an issue is created.
  2. Add an Edit action to update Approvers with the below value that fetches the Owners of the linked objects:

    {
        "fields": {
            "Approvers": {{System object.Owners.flatten.asJsonObjectArray("id")}}
        }
    } 


Example4: Copy multiple users from multiple objects to a Jira multi-user field when there are no linked objects 
In some scenarios, objects from where you want to fetch the Approver information are not linked to the issue. In that case, you can add a lookupobject action first to fetch the objects you are interested in.
Let's assume you have an object type Service desk teams with the team member information stored in Insight. When an issue is created let's say a text custom field or a select list contains the team name that is going to approve the request. 

  1. Create an automation rule that triggers when an issue is created.
  2. Add a lookupobject action that returns the Insight object with the team name mentioned on the issue in the text custom field textCF Or select list custom field selectlistCF

    objecttype = "Service desk teams" AND "Name" = "{{textCF}}" ORobjecttype = "Service desk teams" AND "Name" = "{{selectlistCF.value}}"
  3. Add an Edit action to update Approvers with the below value that fetches the Team members of the objects returned by the lookup action:

    {
        "fields": {
            "Approvers": {{lookupObjects.Members.flatten.asJsonObjectArray("id")}}
        }
    } 





Last modified on Aug 5, 2021

Was this helpful?

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