Decrypting masked variable in Flow Designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 11:11 AM
I'm attempting to access the decrypted value of a masked variable in a flow designer flow. The "getDecryptedValue()" method returns an empty string and using the decrypt method of a GlideDecrypter returns the ciphertext. The flow itself is running in a user context, and the account I'm using explicitly has the "catalog_view_masked" role, so I should have access to the plaintext. Am I missing something here?
- Labels:
-
flow designer
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2022 03:02 AM
Hello Colin,
Could you please try using below line of code:
new GlideEncrypter().decrypt(PASSENCRYPTEDVALUE);
Please let me know if it works.
Thanks,
Priyanka R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2024 12:45 PM
Check out the linked support article. It almost worked for me. In my case I was using a "Get Catalog Variables" action. The problem is the outputs are all strings.
I was able to do a GlideRecord request for the RITM. At that point, you can use the getDecryptedValue() method to get the plain text version of the variable.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0681163
Example:
var gr = new GlideRecord('sc_req_item');
gr.get('<sys_id>');
var plain_text_var = gr.variables.masked_variable.getDecryptedValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2025 11:54 PM
Was Really helpful, thank you!!
For anyone looking for solution use this code in your script in flow designer,