XML Import of References

phsdm
Giga Expert

I was under the impression that Import XML drops references and/or records if sys_ids do not match across instances.

To be sure I understood, I tried this:

1. Export one sys_user_group record with "manager" referencing a user.

2. Modify the user reference's sys_id.

3. Import the record to another instance.

I was expecting "manager" to be blank, or the sys_user_group record to fail to load.

Next,   I modified the "manager" display_value to be garbage and loaded (after deleting the record.)

Now the "manager" field was blank as expected.

Going one more step, I made the display_value equal to a different user.   Loading set to that user.

So it seems to me it is possible to load XML for records that reference tables/records with different sys_ids, as long as display_value is present and sensible.

Has anyone seen something in the documentation wiki that discusses this?

Is there some clue in the system dictionary as to whether a given reference will work this way?

1 REPLY 1

cesar_sandoval
ServiceNow Employee
ServiceNow Employee

You have the correct expectation.



When you export a record that has a reference to a sys_user record, the XML Element should look as:



<assigned_to display_value="John Doe">1698ba48123456789abcdefghijklef6</assigned_to>




The target instance will use the value of the "display_value" attribute to match against a sys_user record with the same name.




If there is no sys_user in the target instance with the same name, then the target instance will keep the original sys_id - this is bad because the reference will point to a nonexistent sys_user record.   You saw this yourself when you modified the manager's display_value to garbage.




Your last statement is correct: " So it seems to me it is possible to load XML for records that reference tables/records with different sys_ids, as long as display_value is present and sensible. "




You are also correct in that this is not documented.   We have notified our documentation team about this and hope to get this added into the wiki soon.




Thank you for your feedback,


Cesar Sandoval