This is a old post I had on my earlier blog. I thought I might as well bring it up here to try to clear out how the cloning works.
First let's just talk about how the cloning works in a light version:
- You request the cloning with the System clone->Request Clone. Remember that the data you are cloning are from last night backup. So if you just changed something, you have to set the clone date for tomorrow instead if you want your last changes to be cloned.
- Now it looks at the "Preserve data" table and see what data on the target it should save. The data is stored somewhere else(magically) and will be restored after the clone
- Copies over everything to the target. If the table is in the "exclude tables" it only copies over an empty table.
- Then it copies over the "preserved data" that was stored before the copy.
- Runs the post-clone cleanup scripts.
How to save data on the target:
System Clone->Preserve Data. Here you specify which data you want to save on the target. You can take a whole table or you can set conditions like everywhere else in ServiceNow to just get a specific records from a table.
Now, preserve data does one thing, and that is make sure that the data on the target exists after the clone. It doesn't stop data from the source to be copied over. So if you only fill in the "Preserve Data". It will have data from both the source and the target. Example is the table "update sources" which holds information from which instance you get your updates from. If you put that table in "Preserve Data" it will keep your target source, but it will also copy over the sources "update sources". In real life this will probably look like if you clone production to test, you suddenly have the productions update sources, which is test...
So what you need to do is to put the table in the "exclude tables" as well. Then it will first only copy over an empty table, then copy back the preserved data from the target.
The "Exclude audit and log data" checkbox:
There is also one checkbox I want to talk about and it's "Exclude audit and log data". This checkbox is checked as default and will stop a huge chuck of data to be copied over. And most of the time it's not needed. But it means for example that workflows isn't copied over, so if you after the clone go look into change requests that were copied over, they won't have a workflow connected to them. And that also means for example that the UI Action "Show workflow" isn't visible. It also excludes the audit data which means that the activity log for those records are messed up with time stamps and so. The fix for this is of course to uncheck the field, but unless you have good reason to do this and copy over an extra large amount of data, I recommend not to do it. Since you should still be testing with new records/tickets anyway to see that it all works as intended.
If you want to dig deeper into it, feel free to visit the documentation: System clone