Maintaining sys_id records between instances

rhiannone1
Kilo Contributor

Hi

We have a requirement to keep the creation of companies and locations in sync between our 3 instances (Dev, Test and Production). When these will be created in Production they also need to be generated in Dev and Test. Of course this could be a manual process of XML Export/Import but we are looking to automate this. The difficulty here is maintaining the same sys_id between all systems.

To keep the sys_ids in sync, I’m thinking using a combination of Script Include and Processor to generate the correct format of ServiceNow’s XML Export/Import, and using SOAP to transfer the data. To achieve generating the XML format, the process I have in mind is the form context menu options Export > XML or Show XML. And once the XML INSERT_OR_UPDATE format is generated for the record, it will then be passed to another instance using SOAP. This SOAP call and piece of functionality will be triggered by a business rule on creation or update of a company or location in Production.

Has someone already developed a similar piece of functionality in ServiceNow? Or is there another way to do this, keeping the 3 instances in sync for a few specific tables?

Thanks

Rhiannone

 

2 REPLIES 2

Gurpreet07
Mega Sage

There's a method you need to use to set the sys_id of a record

GlideRecordObject.setNewGuidValue('sys_id_from_production_instance');

You could create data sources and schedule these using scheduled imports but it will not be a real-time sync in that case.

Using XML import sets

rhiannone1
Kilo Contributor

Hi Gurpreet

Thanks for your pointer, got me thinking. And I was able to use the setNewGuidValue() GlideRecord method by implementing a Scripted Web Service which makes it a real-time sync.

Rhiannone