GlideEncrypter is depricating needs alternative code is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2025 01:12 AM
Hi Team,
In my organisation some script includes are using GlideEncrypter API, as we know this API is deprecating, to alternative to this API i modified some part of code, but still it's not working. Can any one please check and let me know my mistake or any other alternative solution. Your answers will be helpful here.
original Script
===========================
Modified Script
setToken: function (name, value) {
var credGr = new GlideRecord('api_key_credentials');
if (credGr.get('name', name)) {
gs.log("update token", "SNSFRIKER.setToken");
credGr.api_key.setDisplayValue(value.toString()); // Use setDisplayValue instead of encrypt
credGr.setWorkflow(false);
credGr.update();
}
else {
credGr.name = name;
credGr.api_key.setDisplayValue(value.toString()); // Use setDisplayValue instead of encrypt
credGr.context_name = 'SalesForce';
credGr.user_name = 'SalesForce';
credGr.setWorkflow(false);
credGr.insert();
gs.log("insert token", "SNSFRIKER.setToken");
}
},
getToken: function (name) {
var tok;
var credGr = new GlideRecord('api_key_credentials');
if (credGr.get('name', name)) {
tok = credGr.api_key.getDecryptedValue() + ''; // Use getDecryptedValue instead of decrypt
}
else {
tok = this.tokenRetrieve(); // Get initial token
}
gs.log("tok: " + tok, "SNSFRIKER.getToken");
return tok;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2025 05:59 AM
Hi @Robbie ,
Thank you for your response, I tried all the ways which you suggested above but unfortunately nothing is working for me.