Script to change package of my widget?

SNnewbie2
Tera Expert

I am trying to change the package under the widget section. It does not allow me to do it because it says "Security prevents writing to this field".

How do I change that?

WIDGET_teST.PNG

6 REPLIES 6

sachin_namjoshi
Kilo Patron
Kilo Patron

You can not change package after widget is created.


Please go to your application and update set and then clone your widget.



Regards,


Sachin


I did that but the default package is global. How do I switch to Service Portal - Service Catalog. The reason I want to do that it is because I created a widget that uses this API but for some reason it doesn't work with the global one.


Hi,



Please run below background script to change package for your widget



var wd = new GlideRecord("sp_widget");


wd.addQuery('name',"Cool Clock");// update your current widget name


wd.query();


while(wd.next()){



wd.sys_package = "4907294cdbf203008d73771c8c96198d";// this is sys_id of Service Portal - Service Catalog package


wd.setWorkflow(false);


wd.update();




}



Regards,


Sachin


Where do I insert this script? I don't know where to place it!