How to reference a secret in a workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 08:05 AM
Hey everyone,
I’m trying to access an API key in a workflow studio script and I’m having a few issues on getting it to work. The script is supposed to reach out to a few websites holding IP information and return any available data. If I test the script with a hardcoded api key, it works fine. When I try to store the key as a credential and reference it, I think the key is coming back encrypted. I also tried getting the credential through an alias and that didn’t return anything so I am most likely doing that wrong.
If anyone can share how I can store an API key in ServiceNow and reference it in a workflow script, it would be greatly appreciated.
Thank You
Also, if you need more info on my script feel free to ask. I didn’t want to flood this page with 200 lines of different versions of the same script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I found it out.
If you go to the "all" menu and type "sys_properties.list" then press enter. You can make a new system property by clicking "new" in the top right. From here you can make a custom variable that has its type as "password" that can be referenced in a script.
The value of this variable will not be able to be read normally by viewing it's system properties page however, which is what I needed. But a script or a call to that variable name can access it just fine.