Record Producer to Catalog Item

tommyjensen
Giga Expert

Have anybody attempted to write a script to do this?

Need to convert 300 record producers to catalog items and would prefer not to do it manually.

4 REPLIES 4

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

You can automate some portions of this such as variables but there are other settings like the fulfillment workflow that you will need to manually set unless that is the same for all 300.



You could write rite a script that loops through your 300 record producers, clones the details into a cat item, and reprints the variables to the cat item, and then deactivates the record producer.


Thanks, I understand that I won't be able to convert 100% automatically but if I can save 80-90% of the manual work involved than that would be a great result.


Hi tommy, I am looking to do the same task. Mind sharing your code on this? 🙂 Thanks

gaurip
Mega Expert
var gr = new GlideRecord('sc_cat_item');

if(gr.get('7434fcaf4f228410e7fe0ab18110c7dc')) {
	gr.setValue('sys_class_name', 'sc_cat_item');
//	gr.setValue('sys_class_name', 'sc_cat_item_producer');
	gr.update();
}