Exporting/importing CIs and maintaining relationships

adidosc
Giga Contributor

Hi All,


I set a new set of Business Services up in our development system for a new location that came on board, India. I used the + symbol to add the CI relationships for each business service > service, then exported the services and also the relationships from the cmdb_rel_ci table. I then imported the services into our sandbox, which worked fine. The problem was importing the relationships


When I export them as a XML, then import into the sandbox, the list under related items is not the same between development and the sandbox (Support, for instance, has 38 related items in dev while the sandbox shows 11). This problem occured whether I exported then imported only those relationships added on 12/5 (when I worked with the new CIs) or if I exported then imported all relationships. Additionally, if I navigate to the define relationships portion (in the sandbox) and choose depends on, I do not see the CIs from the Available CIs shown in the slushbucket for Support Depends on these CIs as I do in the development system.


I have been looking on the Community site and on the internet for more information, but it looks pretty straight forward, exporting from cmdb_ci_service and cmdb_rel_ci and then importing the XML files into the target instance. Is there something else I'm missing to make this work? Or am I expecting a different result than I should?


Thank you in advance!

3 REPLIES 3

williamsun
Mega Guru

I believe when you import XML it will coalesce on sys_id, so maybe dev and sandbox CIs have different sys_ids?


I would just export and import the relationships in an excel sheet and coalesce on name (if you can).


marcguy
ServiceNow Employee
ServiceNow Employee

as William says, the sys_ids are probably different, in the xml file, that's all that is being stored in the parent/child/type field values, because they are just reference fields.



If they are different what you could do instead of importing via xml, is to run an import from excel and map your parent/child/type columns as then it will use the name which is display value.



Alternatively, export the actual CIs as xml from one instance to another, so that all of the sys_ids are matching up everywhere.


adidosc
Giga Contributor

Thanks for the responses mguy and William Sun! I did try exporting the CIs and then the relationships separately, and confirmed that the sys ids are the same on both source and target environments. I looked briefly at creating a transform map but abandoned it in favor of trying to use the export/import xml method. Maybe I'll have to try it again with an Excel export.