Protection Policy is set to Read-Only

Ling2
Mega Contributor

Hi all,


Does anyone know how do I make the Script Includes editable after cloning?1111.png

If anyone knows how to set disable the protection policy to read-only, please let me know.

Thank you.

5 REPLIES 5

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.