Deleting Read-only Script Include (that I created)

Justin Lee2
Tera Guru

I was reviewing a Global script include with read-only protection policy.  I clicked on "Insert and Stay" to make a copy of the script, that I was going to change to make my own script.

However, the copied script include also has a read-only protection policy (and is in global).  I can't delete or rename it.

So now I have a duplicate global (OOB) script.  How can I go about deleting this duplicate script?

Thanks

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

I found HI article.

Description

An application file with read-only protection policy cannot be deleted. However, it is sometimes appropriate to need such a file deleted, as when a read-only script include is unintentionally duplicated.

Cause

A read-only protection policy applies special protection to an application file that prevents it from being modified or deleted. Only ServiceNow employees can alter the protection policy of an application file, and then modify or delete it.

Resolution

Please contact ServiceNow Technical Support for assistance to delete the application file.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0789968

Best Regards
Aman Kumar

View solution in original post

16 REPLIES 16

Aman Kumar S
Kilo Patron

Try this lil hack:

 

var gr = new GlideRecord("sys_metadata");

gr.get("120c9e354f994200e38d27118110c7d8"); //sys_id of your script include

gs.print(gr.sys_policy);

gr.sys_policy="";

gs.print(gr.sys_policy);

gr.update();

 

Do let me know if this works 🙂

Best Regards
Aman Kumar

It did not work.  And I ran the script a second time (without the update()), and it logged that the sys_policy was still "read".

My guess is Policy is something even GlideRecord cannot update. If it could, what would be the point of having Policy setting.

I agree, but It should be possible to remove from the ones that you have created.

Let me explore more on this, I will get back ASAP.

Best Regards
Aman Kumar

Aman Kumar S
Kilo Patron

I found HI article.

Description

An application file with read-only protection policy cannot be deleted. However, it is sometimes appropriate to need such a file deleted, as when a read-only script include is unintentionally duplicated.

Cause

A read-only protection policy applies special protection to an application file that prevents it from being modified or deleted. Only ServiceNow employees can alter the protection policy of an application file, and then modify or delete it.

Resolution

Please contact ServiceNow Technical Support for assistance to delete the application file.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0789968

Best Regards
Aman Kumar