Automation Anywhere Integration with ServiceNow

March 10, 2022
|
3
min read

Automating repeated processes is crucial for businesses that aspire to modernize their operations while saving time and money. Many automations rely on REST APIs to perform actions in the background, but we often encounter services that have no API support. One such case led us to look for a more unique approach to force automation on an application that doesn’t like to play with others. For services like this, we have found that Robotic Process Automations (RPA) should be considered as a valuable solution. More specifically, we have implemented Automation Anywhere’s digital bots that are capable of mimicking user interactions by cloning UI elements. With this capability, AA offers a creative solution for complex manual processes that include steps taken on any User Interface.

Once the Automation Anywhere bots are deployed and ready to be used in production, they can be triggered or scheduled via the Control Room, which acts as the main dashboard for controlling the organization’s bots. However, considering that triggering bots from the Control Room is either a manual process or done by pre-defined scheduling, the automation can lack the flexibility that is required in many cases. In our use case, we wanted to trigger a bot on demand while eliminating any human intevation until after the task completion. Therefore, we decided to utilize AA Control Room APIs to trigger bots via REST calls from ServiceNow. We were now able to expand the capabilities of AA and create a full end-to-end automation. It is then easy to see the advantage of this approach when considering ServiceNow’s many components and third-party integration that can act as a process trigger: Service Catalogs, Event Management tickets, Business Rules, Scheduled Jobs, etc.

Moreover, using Control Room API allowed us to send values in a JSON format from ServiceNow to be used as bot variables. These values can be data generated in ServiceNow and/or received by any external tool integrated with SN.

Example Workflow:

How To:

See the full Control Room APIs documentation, and JSON examples here.

To start, we need a valid Control Room user with sufficient permissions. The user’s credentials will be used in order to obtain an authentication token via a REST call. We can authenticate by username and password, or an API token generated from the Control Room. It is recommended to store the values as SN credential records.

We can then use the REST Step in SN Flow Designer to retrieve the Authentication Token using the Control Room Authentication API with the following call:

       POST {{ControlRoomURL}}v1/authentication

A token value is returned from the Control Room and will be used for the deployment REST call.

Next, the Control Room Bot Execution Orchestrator API can be used to trigger the bot, specifically with this call:

POST {{ControlRoomURL}}v2/automations/deploy

The deployment call requires the following details that can be obtained from the Control Room:

  • “field” -Bot ID, can be located at the end of the URL when editing a bot record in Control Room
  • “runAsUserIds” - Control Room User ID(s)
  • “deviceIds” - Bot Runner ID(s)
  • “botVariables” - optional, list of variables to be used by the bot
  • "runWithRdp": true - optional flag, equivalent to “Run bot runner session on Control Room” option in the CR UI

When passing bot variable values, make sure to match the variable names in the payload body to the ones used by the bot. 

Variables should be entered in this format:

“botVariables”: {
       “varName”: {
   “type”: ”STRING”, // string example
   “string: “value”
   }
}

The response includes the new deployment ID, which can later be used to look up the bot execution status via the following Bot Execution Orchestrator API call:

POST {{ControlRoomURL}}v2/activity/list

Callback from Automation Anywhere

We can complete the end-to-end automation by having the Automation Anywhere code send data back to ServiceNow. To achieve this, we can create Scripted REST APIs to handle the target endpoints on the ServiceNow side. And on the Automation Anywhere side we can use the REST Web Service action to report the status, results, or other data as a JSON string.

If the Scripted REST API requires authentication, the username and password of the SN user should be added to the Control Room Vault and be used by the bot in the REST action’s authentication field.

We can then see that integrating Automation Anywhere’s Control Room APIs with ServiceNow Flow Designer can provide a more complete end-to-end automation and deployment versatility that cannot be obtained by Control Room on its own. Following the steps covered in this post, together with the information in the AA documentation, opens up your operation to endless possibilities of custom ServiceNow applications that can answer a wide variety of business needs.

written by
Dor Vaknin
Dor Vaknin
Boston
Born and raised by the Mediterranean Sea. He is a curious engineer experienced in ServiceNow and external integrations. Passionate about all things tech, exploring cultures and outdoor adventures.
Back to main Blog