Introduction
Do you use ServiceNow to manage your business workflow? If so, this integration is for you. It allows different actions to be performed from a single endpoint. The supported actions are:
- Create a task
- Monitor a task
- Create and monitor a task
- Update a task
Requirements
To perform any of these actions, users need an instance of ServiceNow, a username or email pertaining to the instance, and a password associated with that username or email.
Creating a ServiceNow Job
To enhance your digital workflow, download the ServiceNow plugin Automation Hub. You can then start to define a job and will find ServiceNow under the category “Human Tasks.”
Figure 1: ServiceNow category on DWC (Dynamic Workload Console)
Connection
Both your ServiceNow instance name (for example: https://dev12345.service-now.com/ => name: dev12345) as the host, and the credentials for that instance, are required for the connection's initial step. A second option is to authenticate using an OAuth token (shown in the second image); for this method of authentication, the field OAuth User is only necessary if the chosen password type is User or Agent User. To prevent unexpected failures during runtime, it is advised (but not necessary for storing and submitting the job) to click the "Test Connection" button.
Figure 2: Basic Authentication
Figure 3: OAuth authentication
Action
In the action tab, the user can choose which action to perform (Create, Monitor, Update) via radio buttons; the additional action Create and Monitor can be performed by checking a checkbox inside the Create action instead.
A useful feature of this tab (common to all the actions) is validation. It is, in fact, recommended to validate the fields before saving, especially if you are not certain about whether the values inserted in each field are valid. The button “Validate Input” goes through all of the user-filled fields and checks for discrepancies with respect to what is expected. If discrepancies are found, an error message is presented to the user, indicating what needs to be changed.
It is also important to know that to use any of the buttons present in the plugin, the test connection must be performed.
Create
If the desired action is “Create,” it is mandatory to insert the table name (for example, the type of record to be created). Since the tasks you can create depend on how your instance is configured, the “Search” button will help by giving a list of the available tables.
Figure 4: Search button provides the list of available tables.
Once the table is selected, the user must fill out the mandatory fields in the context of that table. This can be done by clicking on the “+” button. An example of “Create” with filled fields is provided (see the figure below).
Figure 5: Creation of a task (in this example, a ticket)
Alternatively, if you do not know what the mandatory fields are, the “Get Fields” button will provide a list of all the fields, with the mandatory fields (if any) selected by default.
Figure 6: Example of “Get Fields” button result
Important information
There are a few crucial details to keep in mind with respect to the “Create” action:
- If the task is created with basic authentication, the caller_id is automatically populated with the id of the user that created the task. On the other hand, if the task is created with OAuth authentication, it is advisable to add the field caller_id manually through the user fields.
- The user should be familiar with the date format accepted by that instance of ServiceNow.
Monitor
To perform the monitoring of a task, the “Monitor” radio button must be selected. After that, the id (or the name) of the task to monitor must be specified along with the state to monitor, which can be an approval and/or rejection state. In fact, the user may insert the approval state and/or the rejection state that the previously specified task must reach for the monitor to finish. If both are inserted, the monitoring will end as soon as either one is reached. Neither of the two states is required but at least one must be filled. In case the user is unsure of the correct values for states, the “Get State” button will provide a list of available states.
Figure 7: Example of "Get State" button result
Note that multiple states can be inserted; in this case, when any one of the states is reached, the monitor finishes. Other fields available are the polling interval and polling timeout; if skipped, default values of 30 seconds and 1 day will be assigned, respectively. On the other hand, upon user input, the values are reassigned as desired.
An example of monitoring is shown below:
Figure 8: Monitor example
In the above image, the polling interval and polling timeout will not be the default values; instead, they will correspond to 5 minutes and 3 days respectively. Although the accepted format for these fields is the one shown in the picture, the user is also allowed simply to write “10s”,”10m”, or “1d”, in which case they will automatically be converted into the right format.
Create and Monitor
Furthermore, if you want to keep an eye on the ticket you have to create, you perform the creation and monitoring of a task, for which you have to select the “Create and Monitor” checkbox that is under the “Create” action. Creation can then proceed as described in the Create paragraph; monitoring works as described in the Monitor paragraph.
An example of “Create and Monitor” is shown below:
Figure 9: Create and Monitor example
As you can see, the states in this example are inserted as numbers, whereas in Figure 8 they are inserted as strings; this is possible because both formats are allowed. You can also mix them up by writing “2, resolved” or “on hold, 7” (which are four different states). Of course, these values have to be coherent to the instance you are using.
Update
An update function is also available in case you need it. First, select the “Update” radio button; then insert the id (or the name) of the task to update and the fields you want to update inside the task. This can be done by clicking on the “+” button.
An example of “Update” can be seen in the following image:
Figure 10: Update example
NOTE: To delete the value of a previously filled field and leave it empty, the string “unset” must be inserted as field value. It is also important to remember that through this operation, all of the values inserted will replace the previous values (if any are present). For instance, it is not possible to add a value to one that has already been inserted: in this case both (or all) desired field values need to be inserted.
Note also that the user can click on the “Get Current Fields” button to see a list of all the fields (and their values) corresponding to that task. An example is shown below.
Figure 11: Example of "Get Current Fields" button result.
Stability
This integration is ready to deal with the sort of unexpected events that can happen occasionally. In fact, if you are performing any of the available actions and your server goes down, reconnecting is the first thing the plugin will do when the server is up again.
Reconnect
The reconnect functionality checks the job properties. Specifically, with respect to the “Create” and “Create and Monitor” actions, the task id is checked; if it is not found, the action is executed from scratch. With respect to monitoring, the reconnect functionality checks the task state, the polling interval, and the polling timeout; if the timeout was not reached and the task state does not match any of the required states, polling resumes from where it stopped. When the server goes down during update, the reconnect checks a property that indicates whether the update was successful or not.
Start a Conversation with Us
We’re here to help you find the right solutions and support you in achieving your business goals.