The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Protection Policy in Script include for Scoped application

Deepika48
Mega Expert

Hi,

In an scoped application, Protection policy of a Script Include has been set to Read -Only by mistake and moved to Test instance, now I am not able to change the Protection Policy from Read-only to None in test instance  .

Do anyone have idea ,how to chnge the Protection policy back to None.

Thanks

3 REPLIES 3

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

Just run this script in background as admin:

var gr = new GlideRecord("sys_metadata");

 

gr.get("120c9e354f994200e38d27118110c7d8");//This should be the sys id of the script include

 

gs.print(gr.sys_policy);

 

gr.sys_policy="";

 

gs.print(gr.sys_policy);

 

gr.update();


Thakns,
Ashutosh

Nikhil Bahurup1
Tera Expert

Hi Deepika,

run below script using script background

var gr = new GlideRecord('sys_script_include');
if (gr.get('add sys id of script include')) {
    gs.info('found Script Include' + gr.name);
    gr.sys_policy = ''; //remove protection
    gr.update();

 

PriyaRanji
Tera Guru

Hi Deepika,

Good Day! Please do write the fix script with below code, and run the same. It should works 🙂

var gr = new GlideRecord('sys_script_include');
if (gr.get('add sys id of script include')) {
    gr.sys_policy = ''; //remove protection
    gr.update();
gr.deleteRecord(); --> add this line if you want to delete the record else you can set the value as empty


Thanks,
Priyanka R