ServiceNow restores reference fields while restoring an archived record just with the display name

Anonymous_guy
Tera Expert

Hi Community,

I'm a bit curious about how ServiceNow manages to update reference fields after restoring an archived record in cases where the 'retain references' checkbox is unchecked. The documentation says that if 'retain references' is unchecked, ServiceNow stores the references with their display name as a string, and hence populating the references while restoring is difficult. I found that ServiceNow managed to update the references just with the display names. Please see below how I tested it.

1) Created an archive rule on the change request table with the 'retain references' unchecked. The query was made simple just to pick one record (number = 123)

2) Ran the archival ad hoc.

3) Renamed the group to which the change request was assigned.

4) Restored the record.

5) The record was restored with the updated assignment group name.

 

How was it easy for ServiceNow to update the reference field without the sys ID? Am I missing something on how ServiceNow stores archived data?

Any help would be much appreciated.

Thanks in advance.

4 REPLIES 4

palanikumar
Mega Sage

Hi,

Normally reference field works if you restore using the display name. You will face problem if you have more record with same display name. If all display names are unique then you will not face challenges.

 

Thank you,
Palani

Hi @palanikumar,
Thanks for the reply. However, what would happen if the reference field's display name changed after the archival but before the restoration? For e.g. Assume that I archived a change record with assignment group 'ABC,' and later on, it was renamed to 'XYZ'. Now I wanted that CR to be restored. Given that the CR in its archived state had reference to "ABC," is it possible for the restoration process to update the assignment group reference to "XYZ"?

Hi,

No, it will search only based on the name at the time of backup.

There is another problem in this case, If you have created another group with this name then the backed up record will refer the different group with the same name.

In this case, you should remember the changes on reference records and create script to update them to correct value. 

Thank you,
Palani

Anonymous_guy
Tera Expert

After some investigation, I discovered how ServiceNow is able to restore the reference field even if it has been renamed.
When restoring the record, ServiceNow uses archive logs (sys_archive_log) rather than the archived record entry. Since ServiceNow uses the sys ID to fill in the reference fields during restoration (despite the fact that it is masked in the archived record), it makes no difference if you rename any of the reference fields.