Workarounds to automatically link the Asset 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.



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

While you can import the objects, the object keys are changed. You do not have an option to import objects with the same keys, hence 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.

Users affected by the following bug can also use this article to add the missing links: JSDCLOUD-10332 - Getting issue details... STATUS


Automation for Jira and JSM Assets.


Workaround 1Use an Automation rule to edit the Asset object custom field
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 Asset objects from the Insight cloud app to the JSM Assets 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 Assets 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 Asset 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 JSDSERVER-11242. 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 Asset 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 JSM Assets in server. I am taking two attributes Serial and Brand as well as the object key that I will import to the new JSM Assets 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 Asset 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 Assets and Jira data. To correctly migrate the Asset data refer to the below documents:
    Import from Server to 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 Asset object custom field with the necessary configuration to link these objects. In my example, I have created an Asset 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 AQL 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 Asset object key. For importing the Asset

objects to Jira issues, you need to use the below format of the CSV file:

issue key,summary,Phone object

Where <WorkspaceID> is the same for all JSM Asset object 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 JSM Assets

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


Last modified on Oct 26, 2022

Was this helpful?

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