Encryption script on attachments throws error: org.mozilla.javascript.EcmaError: Cannot find function changeEncryptionContext in object [object GlideSysAttachment]Issue <!-- div.margin { padding: 10px 40px 40px 30px; } table.tocTable { border: 1px solid; border-color: #e0e0e0; background-color: #fff; } .title { color: #d1232b; font-weight: normal; font-size: 28px; } h1 { color: #d1232b; font-weight: normal; font-size: 21px; margin-bottom: 5px; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #cccccc; } h2 { color: #646464; font-weight: bold; font-size: 18px; } h3 { color: #000000; font-weight: bold; font-size: 16px; } h4 { color: #666666; font-weight: bold; font-size: 15px; } h5 { color: #000000; font-weight: bold; font-size: 13px; } h6 { color: #000000; font-weight: bold; font-size:14px; } ul, ol { margin-left: 0; list-style-position: outside; } --> Symptoms Unable to encrypt attachments using a bulk encryption script from documentation (https://docs.servicenow.com/csh?topicname=c_EncryptionSupport.html&version=latest). The script throws an error stating: org.mozilla.javascript.EcmaError: Cannot find function changeEncryptionContext in object [object GlideSysAttachment] Release All Cause The cause may be that the execution of the script is being done in the same scope as the table containing the attachment Resolution The execution of the script needs to be done in the global scope either as a background script, UI Action or Business rule. The encryption context and associated sys_user_role can be in either global scope or in the scope of the table, but the execution of the script needs to be in global scope.