How to synchronize only a few objects across different Insight schemas
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This article details steps on how to sync only some Insight objects from an Insight Schema A to Schema B.
Insight has several built-in importers that you let import your data. For this scenario, we will be using Object schema import. It allows to only select specific objects but their references will not be synced.
It's not possible to filter on the Import mapping with an IQL based on object references, as references to other objects are handled separately after the object is created or updated.
Environment
Jira Service Management or Jira Software and Insight - Asset Management
Scenario
The admin would like to sync some objects from one Insight Schema to another. For the purposes of this article, we will be using the following Insight Schema to show two workarounds that can help you with object's references.
Example:
- There are 2 Objects Types (Customer and Server) and our aim is to copy all Servers related to one particular customer (Customer A)
- Server Object Type will have an outbound reference to Customer Object Type
- Schema B our target will be an empty schema
- Set up an Object schema import and use the pre-defined structure & configuration
Workaround 1
We use the "External Hash Key" created during the import which holds the Object reference, aka Customer's reference. The External hash key is a unique identifier that is created automatically when you use the pre-defined structure & configuration
In the target schema (Schema B)
- On Server object Type, create a new attribute called "temp" as a text. We store our Customer A, External Hash Key
- As we used Pre-defined structure & configuration, there will be 2 new attributes created by Insight (Origin Object Key and External Hash Key). Do not remove them
- Go to the Object schema import and add a new entry to the Server Object Type mapping
- Later, when we run the first import, temp attribute will be filled in with the Customer "External Hash Key"
- Data Locator: Customer
- Insight Attribute: temp
- In the Customer Object Type mapping you can add an IQL to filter by our 'Customer A" so only this Customer will be synced.
- Synchronize the import. It syncs all Server Objects either related to "Customer A" or not. It is expected as there is not a filter yet for Server Object Type
- Now in the Customer Object, we have an External Hash Key and in Server objects, Customer External Hash Key is mapped to our 'temp' attribute!
- Go to your Server Object Type Import mapping configuration and add the following IQL to filter by Servers related to "Customer A"
- Filter data source by IQL: temp = "7e7aaa43d81fddbbf4722f4b17a798a8"
- Synchronize it again.
- Server objects not related to our "Customer A" will be removed by the IQL and only the ones related to "Customer A" will remain. From now on, any updates on the source schema for 'Customer A' will be in sync in our target Schema
- If you have multiples customers to filter by, you could amend the IQL and use: temp IN ("External Hash Key","Other External Hash Key")
Workaround 2
- Import all Servers objects related or not to our "Customer A"
- Set up an Automation Rule to delete the Server objects with no references to "Customer A"
Like the other workaround, we won't use an IQL to filter Objects by using the External Hash Key.
- Create an Insight Automation Rule to remove all Server Objects having customer empty
- Rule triggers when "Object Updated"
- Condition: objectType = Server AND "Customer" IS EMPTY
- REST API to delete objects: {host}:{port}/rest/insight/1.0/object/${objectId}