Protection Policy is set to Read-Only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2015 04:25 AM
Hi all,
Does anyone know how do I make the Script Includes editable after cloning?
If anyone knows how to set disable the protection policy to read-only, please let me know.
Thank you.
- 21,811 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2025 05:07 AM - edited ‎01-02-2025 05:18 AM
Update: 1/2/2025
Although this seeems like a good workaround I don't recommend this solution, especially for scoped applications.
My requirement was to remove the protection policy of an email script. However, I run in all kinds of errors.
This is the fix script I used within the Deployment Pipeline app:
// Edit Protection Policy to Write
(function executeFixScript() {
var gr = new GlideRecord('sys_script_email');
gr.setWorkflow(false); // Prevents business rules from triggering during the update
if (gr.get('<sys_id_of_the_email_script>'')) {
gr.setValue('sys_policy', ''); // Removes the protection policy
var success = gr.update(); // Save the changes and capture success
if (success) {
gs.info('Protection policy successfully updated for script: ' + gr.getValue('name'));
} else {
gs.error('Failed to update the protection policy for script: ' + gr.getValue('name'));
}
} else {
gs.warn('No record found with the provided sys_id.');
}
})();
Even after trying to run the same script in the global scope, it also run into all kinds of issues.
Basically, removing protection policies via fix scripts is not a good idea especially for scoped applications.