Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

to create exact copy of a catalog item with my own sysid

Sachin Gavhane
Giga Guru

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?

7 REPLIES 7

@Sachin Gavhane 

then in that case please check the code in OOB Copy UI action and see if you can set the sysId from script

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Sumanth16
Kilo Patron

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

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