ServiceNow authentication action

Use the Authentication action to connect to your ServiceNow instance. After the authentication is successful, you can use other command actions to perform various operations in ServiceNow.

Prerequisites

  • You must have the Client ID and Client secret generated in your ServiceNow instance. To generate the Client details, see Create an OAuth API endpoint for external clients.
  • You must have the Bot creator role for your Automation Anywhere Control Room to use the ServiceNow package in a bot.
You can use different connection methods to connect to ServiceNow:
  • OAuth2 - Client Credentials: Use this connection method by providing the Salesforce account credentials. You need a Salesforce username and password to establish a connection.
  • Control room OAuth connection: Use this connection method by creating an OAuth connection and storing it in the Control Room. You must configure an OAuth connection in ServiceNow before creating the OAuth connection in Control Room. For more details, see Create an endpoint for clients to access the instance.

Procedure

  1. Log in to the Control Room.
  2. Create a new bot or edit an existing bot. See Create your first bot.
  3. From the Actions pane, select ServiceNow > Authentication and place it under the start of the bot flow.
  4. In the Authentication Type field, select the authentication method from the drop down.
  5. To view client ID and client secret details in ServiceNow for OAuth2 - Client Credentials authentication, complete the following steps:
    1. Log in to your ServiceNow instance.
    2. Click All > Application Registry.
    3. Select the OAuth you created.
    4. Use the Client ID and Client Secret in your Authentication action from the Control Room.
  6. To connect using OAuth2 - Client Credentials, complete the following steps:
    1. In the ServiceNow URL field, enter your ServiceNow instance URL.
    2. (Optional) Enter the API version.
    3. In the Client ID field, enter the Client ID copied from ServiceNow. In the example video below an Insecure string is used, while you can use Credential or Variable options for better security.
    4. In the Client Secret field, enter the Client Secret copied from ServiceNow.
    5. Enter the ServiceNow user name.
    6. Enter the ServiceNow password.
      Note: You can use one of the following options to specify the Client ID/Client secret/ username/ password:
      • Credential: Enables you to use a value in the Credential Vault that contains information about the Client ID/Client secret/username/password.
      • Variable: Enables you to use a credential variable that contains information about the Client ID/Client secret/username/passwordRI..
      • Insecure string: Enables you to enter the Client ID/Client secret/username/password manually.
  7. To configure a Control room OAuth connection in ServiceNow, complete the following steps:
    1. Complete step 1 to step 5 in Create OAuth connection.
    2. Log in to your ServiceNow instance.
    3. Click New > Create an OAuth API endpoint for external clients.
    4. Enter the following details:
      1. Name: A unique name.
      2. Client ID: Client ID is automatically generated by the ServiceNow OAuth server.
      3. Client Secret: Client secret is automatically generated.
      4. Refresh Token Lifespan: Validity of refresh token in seconds.
      5. Access Token Lifespan: Validity of access token in seconds.
      6. Redirect URL: Add the Callback URL from Create OAuth connection as an authorized redirect URI.
      7. Enforce Token Restriction: Restricts the access token usage to the API 's defined in the REST API Access Policies. If this option is not selected, access token usage across other REST API's is allowed.
    5. Click Submit.
    6. Go to Application Registry. Click the info icon and copy the client ID and client secret.
    7. Go to Create OAuth connection and complete the remaining steps to create an Oauth connection with the above details.
  8. To connect using Control room OAuth connection, pick a custom connection you have created and stored in the Control Room. For more details, see Configure OAuth connections in Control Room.
  9. Enter Default as the Session name.
  10. You can assign the authorization header to a variable by creating either a Multiple or Dictionary variable.
  11. Click Run to save and run your bot. Once authenticated, you can use the token to call other ServiceNow API services.