Migrate Incident data from one instance to another instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 11:07 PM
Hi Team,
I have a requirement to export incidents(700) from one instance to another instance,including emails,audit history.
I have exported all the incidents using xml,but the history of tickets was not moved.For that I thought of moving sys_audit for those incidents.
But in sys_audit table,is there any possibillity to export all the history of those 700 incidents instead of doing it one by one as below screen shot.because we dont have "is one of" operator
Any suggestion i can get will be very helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 11:24 PM
Hi @VanamaA
1)You can import from incident table, sys_email table,sys_audit table, if you have sys_id of 700 incidents.
2)As i can see from the screenshot you are trying to filter using document key, if you create the field to tag those incidents like "migration" , then in the autid table , you can use "documentkey.incident.u_migration=true"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 11:31 PM
Hi Sundarjm,
We are not able to do Dotwalk on Document key,then how we can use "documentkey.incident.u_migration=true" or am I missing something,could you please eloborate/provide me any other solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 11:47 PM
document_id is not a static reference—it can point to different tables like Incident, Change, etc.
Dot-walking assumes a fixed reference type, so it doesn’t know how to resolve fields like u_migration unless the table is explicitly known.
- that is the reason it is failing the dot walking here .
- There is a workaround mentioned below ,please try :-
Dot-walking doesn’t work well on dynamic reference fields, but you can use getRefRecord() to access the actual record it points to.
javascriptvar gr = new GlideRecord('sysapproval_approver');gr.get('your_sys_id_here');var doc = gr.document_id.getRefRecord();gs.info(doc.u_migration); // Access the field from the referenced record
This method works because getRefRecord() returns the actual GlideRecord object of the referenced record, allowing you to access its fields directly.
.One more work around :- If you're trying to do this in a Client Script, you’ll need to use GlideAjax and a Script Include to fetch the field value server-side.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Akanksha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 01:09 AM
Hi @VanamaA
You can clone , that is more easy & quick.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 03:58 AM
I feel like it would make more sense for you to use a script that loops through each incident and creates a REST message which is posted on the target instance. Basically you'd just need to use table API to post the audit record directly to the other instance and it should work without issues if you have the exact same sys_id there. If not, you could create an import set table where you post the data with the original number included and you could use that to handle the data.