How retrieve password stored as credentials into script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2025 03:56 AM
Hello Folks!
I am running into bit of a problem.
I have a script include that execute Outbound REST API call.
Trying to build this script include as safetely as possible therefore i have stored the API Key as a password in the Credentials table.
The regular glide record failed to retrieve value from that table so i found GlideCredentialUtility but i expect i am doing something wrong to get the value.
Here is my snip-set:
-------------------
sys_script_include.b04412b7475cae109371eee3716d43bc.script : Line(23) column(0)
Stack trace:
at sys_script_include.b04412b7475cae109371eee3716d43bc.script:23 (callAzureFunction)
at sys_script.81e7dee347986e109371eee3716d439d.script:5 (executeRule)
at sys_script.81e7dee347986e109371eee3716d439d.script:8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2025 07:14 AM
check this
Outbound REST Message and client credentials
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2025 09:10 AM
Thanks Ankur this sounds like an interesting work around but it requires creating rest message to store the API Key for script include that will be triggered by business rule to make call to get the token first then use that token to perform one more api call to third party endpoint. I would ideally limit my configuration to one business rule executing the script include that can access the credentials record. I will keep this in mind though in case i cannot figure another way around.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2025 09:32 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2025 11:34 PM
I went to use a sys_properties table that supports 2way encrypted password but part of my brain still wonders if it is possible to extract value for credential store into the Script Include.
I am aware that the easiest approach would be to create Rest Message however in my case it won't solve my business problem. The application i am building will store multiple keys related to multiple environments. I need to create a central spaces where users store environments record then tight them up to the stored credential without needing to know how to build a rest message.