Workarounds to automatically link the Insight object to Jira issues

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

A lot of customers are migrating Insight data from the Insight cloud app, or from the Insight server to the new JSM Insight on cloud available with our Premium ad Enterprise offering.

While you can import the objects, but the object keys are changed. You do have an option to import objects with the same keys, so you cannot import the object-issue links. You have to manually link the objects again to the Jira issues and this can be a nightmare. Here are a few possible workarounds to help you automate this process to see if it suits your use case scenario.

Environment

Automation for Jira and Insight asset management 

Solution

Workaround 1Use an Automation rule to edit the Insight object
For this, you need to use the scheduled automation trigger. Now we can only execute a rule on 1000 issues at a time and each execution will take some time because it has to edit 1000 issues. To prevent the rule throttling due to service limits for Automation, you have to set the rule schedule accordinglyAlso, make sure you test out the rule on a few issues first to make sure that it works as expected. 

If it is a migration of Insight objects from the Insight cloud app to the JSM Insight on the same cloud site, then the first two steps have to be performed on the same cloud site. However, if you are migrating the Insight and Jira data from a server instance, then perform these two steps on the server-side before you move the Jira data to the cloud site. 

  1. First, you need to add a workflow transition that copies one of the unique attributes or a set of attributes that makes the object unique, from the asset type field to a text custom field using the Insight post function. Make sure that these attribute uniquely identifies the object. Also, that none of these attribute values contain white space. Next, avoid using more than 3 attributes because the post function to copy the values might not be complete due to the bug ICC-51. This bug is also a problem if you have multiple assets custom fields for each Jira issue because the number of attributes that you need to copy in that case will increase. Then you have to add multiple workflow transitions to copy these attributes, as we recommend using only 3 Insight post functions per workflow transition.

    If you don't have an attribute or combination of attributes that uniquely identify your object Or you have it but it contains a space Or you have multiple asset fields per Jira issue, in that case, you have an option to only copy the object key to the text field. In this case when you import the assets later, then make sure you import the object key to another attribute, let's call it Old Key and use this attribute for identification.

    Here is an example, here is an object type in my Insight cloud app or server app. I am taking two attributes Serial and Brand as well as the object key that I will import to the new JSM Insight as Old Key into consideration to uniquely identify each object to cover all the combinations. You can use only one attribute for example Serial or just the object key as well if you can find the correct object with that attribute value:


    Create a transition called Copy Assets that transitions from Any status to Itself. So that when we use this transition, the issue transitions back to itself while executing the necessary post functions to copy the Asset attributes:


    Add post function to copy the Asset attributes to the text fields. 
    In this example, we have Asset Tag custom field of type Asset that has reference to the Insight cloud app assets. We use the Insight post function "Set a Jira field with the attribute value from a selected object" to copy the object attribute values to the text field with the same name. 
  2. Bulk transition these issues to execute the post function and copy the value to the text custom fields
    Cloud - Edit multiple issues at the same time
    Server/DC: Edit multiple issues at the same time 

  3. On the destination cloud site, make sure you have migrated the Insight and Jira data. To correctly migrate the Insight data refer to the below documents:
    Import from Server to Cloud
    Migrate Insight Cloud to Insight in JSM cloud

    If you plan to import the previous object key based on the discussion mentioned above, you can edit the CSV file as follows:

    As a result, you get the below objects in the JSM cloud when you import the old object key.


  4. make sure that you have set up an Insight custom field with the necessary configuration to link these objects. In my example, I have created an Insight object field Phone object and added it to the issue screen.

  5. Next, Schedule an automation rule, that executes for all the Jira issues for which the Phone object field is empty. 

    Add an edit action to edit the Phone object  using the below IQL that will use the same values from the text custom fields:

    "Serial" IN ({{Serial}}) AND "Brand" IN ({{Brand}}) AND "Old Key" IN ({{Old Key}})

Workaround 2: Use Jira CSV import to import the object information

The CSV import is a more tedious workaround if you don't want to use automation in workaround 1. For this, you can try to copy the Name or any other unique attribute or the previous object key to a text custom field first. Export Jira issues with these values and then use excel functions to find and replace the old value with the new object key with the help of the unique attribute that you have exported.

You can then Import the issues with the new JSM Insight object key. For importing the Insight objects to Jira issues, you need to use the below format of the CSV file:

issue key,summary,Phone object
DEMO-8,text,<WorkspaceID>:687

Where <WorkspaceID> is the same for all JSM Insight objects on your cloud site and 687 is the key number of the object TEST-687. You can discover your workspace ID using the API mentioned on Using REST APIs with Insight

Alternatively, you can create a script to find the new objects using IQL by querying the unique attribute with the help of API endpoint Get iql objects and then use Jira edit issue API to update the issue with the object value:

{"fields":{"customfield_10249":[{"id":"<WorkspaceID>:687"}]}}

Last modified on Aug 5, 2021

Was this helpful?

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