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.

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

Hi Kalai, which one ?


I'll try it on our upgraded instance and on a new build


It was for one of scoped app script. It is a custom script.


Not many scoped apps at this client, and of those I am not sure if any have a protect SI to check with


I'll have a look when I get a chance


Hi Kalai,

It will work when run via fix script, you can try to add the same script in the fix script. 

Thanks,

Priyanka R

Run the below script in background script.. this will help you make the SI editable



var rec = new GlideRecord('sys_script_include');


rec.addQuery('name', 'Name of your script include');


rec.query();


if(rec.next()) {


rec.sys_policy = 'NULL';


rec,setWorkFlow(false);


rec.update();


}