StandardCredentialsProvider not working for non-admin users

Alexandre Freit
ServiceNow Employee
ServiceNow Employee

I created a Script Include that uses sn_cc.StandardCredentialsProvider to retrieve a given credential I need to consume a REST operation. When this script include is called by my user (e.g. through a UI Action), which has the admin role, it runs as expected. However, when the script include is called by a non-admin user, the script fails because getCredentialByID returns null. Is there a way to make this script include work for non-user admins too?

1 ACCEPTED SOLUTION

Alexandre Freit
ServiceNow Employee
ServiceNow Employee

I found a solution for this issue. Since I'm consuming the REST service using RESTMessageV2, creating a basic authentication profile and using it with the setAuthenticationProfile method enabled the script include to run when called by non-admin users.

View solution in original post

5 REPLIES 5

With that being said: We may want to consider to not perform that rest request directly in a business rule but through an event - where the event script is then executed as a technical user/admin/system context.