Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Is it possible to decrypt values in an encrypted text field using script?

Angie Lee
ServiceNow Employee
ServiceNow Employee

We have a encrypted text field used on HR table. There is no problem viewing encrypted text field in report under appropriate context. However, when report exported out to Excel data is missing. What we thought is to have a script to get data from HR table and decrypt the encrypted values. When I query the encrypted field by script, it return the encrypted text(a long string). Anyone knows anything about encrypted field content, how we can get the decryted values by script?

3 REPLIES 3

DubeyN
Mega Expert

Did you manage to fix this issue. I also have similar requirement, where user want to send encryption field value in email.

Regards,
ND


CapaJC
ServiceNow Employee
ServiceNow Employee

Looks like you need to set the context ID for the field and then use getDisplayValue.

http://wiki.servicenow.com/index.php?title=Encryption_Scripting#setContextID
http://wiki.servicenow.com/index.php?title=Encryption_Scripting#Returning_a_Decrypted_Field_Value


Aman Gurram
Giga Expert

value from an encrypted field can be retrieved in script by using getDisplayValue()



Encryption scripting examples


Return a decrypted field value

You can return the field value for an encrypted field by using the getDisplayValue method.