fix script to copy data except one field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 01:24 PM
Suppose I have a table 'cmdb_ci_business_app', I wanted to create duplicate of all records present in this table except one field 'short_description'.
I am trying below script and it is not populating data for technology_stack and it_application_owner fields as existing records
var gr = new GlideRecord("cmdb_ci_business_app");
gr.query();
while(gr.next()) {
var newGr = new GlideRecord("cmdb_ci_business_app");
newGr.initialize();
newGr.technology_stack = gr.technology_stack.toStrin();
newGr.it_application_owner = gr.it_application_owner.toStrin();
newGr.short_description='Tash Dubrovska';
newGr.insert();
}
Please help me on this.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 01:41 PM
Hi @aagman4 ,
Please try below article to resolve your issue:-
Solved: Copy record into the same table with new sys_id - ServiceNow Community
I hope this helps
Please mark my answer correct if this helps you
Thanks
Mohit