- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2022 11:57 AM
I want to copy all the records in table A to table B.
Is there a way to copy in a script without using record export / import?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2022 12:01 PM
Hi @Carol543 ,
You can write a background script
var gr = new GlideRecord('tableA');
gr.query();
gr.setLimit(1); // test for 1 record after that use 100 or 500 as limit so that browser will not hang
while (gr.next()){
var rec = new GlideRecord("tableB");
rec.initialize();
rec.field = gr.field; // map the field name like this
rec.insert(); // insert to b table
}
Regards,
Gunjan Kiratkar
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2022 12:05 PM
As of now It is one time use only and may be needed to use in future as well as per requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2022 12:10 PM
I would just create in flow designer similar to this structure. No code required, just drag and drop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2025 11:05 PM
Hi,
How to use fix scripts to move data from parent tables to child tables?
Eg: from server table to windows and linux tables?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2023 05:37 AM
But in this case, do we have to add all fields at "Create Record" Field values