Script include protection read only

ravi2k
Kilo Contributor

Hi Frds,

I`m facing a issue in script include, created script inculde and set protection policy as read only on Fuji version. I have admin rights but not able to edit this? I want to edit or delete this script include. Pls help.

Thanks,

Ravish

1 ACCEPTED SOLUTION

var gr = new GlideRecord("sys_metadata");  


gr.get("42ec6aa0ef62210066fc36caa5c0fbce");   // sys_id of record


gs.print(gr.sys_policy);  


gr.sys_policy="";  


gs.print(gr.sys_policy);  


gr.update();  


View solution in original post

14 REPLIES 14

Ajai S Nair
Giga Guru

shaikbasha
Kilo Expert

Write background script to update Script include


1. update the protection value as none, so that you can update the script include



var rec = new GlideRecord('table name');


rec.addQuery('sys_id',sys_id);


rec.query();


if(rec.next()) {


rec.field_name = 'NULL';


rec.update();


}



2. delete the script include


GlideRecord - ServiceNow Wiki



Note : to turn on the back ground script.. you have to enable the Elevated privalizes


Hi Ajai,


Thank for the reply, I did R&D on servicenow community linkes help but not able to find any correct solution which i can did my self.



Hi Basha, Thank you for your response, could you pls tell me in detail how to write background script, is there no any other way if i want to delete this? Thanks.




script include.png  


var gr = new GlideRecord("sys_metadata");  


gr.get("42ec6aa0ef62210066fc36caa5c0fbce");   // sys_id of record


gs.print(gr.sys_policy);  


gr.sys_policy="";  


gs.print(gr.sys_policy);  


gr.update();