to create exact copy of a catalog item with my own sysid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 07:21 AM
Hi, I have a requirement where I need to make a copy of the catalog items and its complete related data [ all variables / catalog client scripts] , but the copied catalog item should have sysid given by me.
with below script , I am able to create blank catalog item with the given sysid, but i want to make it a copy of another catalog item.
//var now_GR = new GlideRecord('cat_item');
//now_GR.setValue('short_description', 'The third floor printer is broken'); //now_GR.setNewGuidValue('eb4636ca6f6d31005be8883e6b3ee333');
//now_GR.insert();
//gs.info(now_GR.getValue('sys_id'));
can someone pls help me with this query?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 10:20 PM
then in that case please check the code in OOB Copy UI action and see if you can set the sysId from script
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 08:11 AM
Hi @Sachin Gavhane ,
Once you open catalog item form from 'maintain items' there is button 'Copy' once you click it will create a copy of item with new sys id.
if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 10:42 AM
Hi @Sumanth16
Thanks for your reply.
But the newly created catalog item should have the sysid which i will give.
I mean, I wish to have newly created catalog item with the given sysid
Please help me with this issue.
Thanks
