WS1 + ServiceNow Part 2

Introduction

Over the last few weeks I have been spending a bunch of time understanding how Workspace One and Service Now can work together to make our customers lives easier. This is the second part in my VMware Workspace ONE and Service Now blog series, in part 1, we worked out how to use the Workspace ONE Intelligence tool to automatically feed device records into Service now, and map data elements to their correct fields in Service Now. 

In part 2, we are going to work out how to feed data the other direction - from Service Now back into Workspace ONE UEM. The use case we are going to consider is devices going though a break / fix cycle and help desk or admins managing that in the Service Now console. While the device moves though the break / fix cycle, we will apply a tag in the UEM console to ensure the status of the device is reflected properly in both tools, and to ensure apps, policy configurations, compliance rules, etc.. are in an appropriate configuration on the device.

Requirements and prep work

For the work today, we will need a ServiceNow instance, and an Workspace ONE UEM instance. 

Based on Part 1 of this series - we were able to sync device records and meta data from UEM to Service Now. There is 1 attribute that we didn't mention syncing in the last series, but we will be using in this series. That is Device ID. We will need that attribute to match the 2 systems together easily. 

The next step is to launch the Workspace ONE API Explorer 

This URL will depend on your specific Workspace ONE Implementation, in general for Hosted SaaS models, the API server follows the naming convention of your Admin Console Server. In an On premise deployment, the API service is installed by default on both the Admin console and Device Services endpoints. Whats important in the on premise model is that the Service Now instance can reach that API server. 

Next lets generate a UEM API key for Service Now to use 

Next lets generate an a new service account that has API access for our ServiceNow integration to use

Next lets get our organization group code

And finally lets get a Device ID for us to test the tag application via API. 

At this point we have a Service Account created, an API key created and our Organization group code 

UEM Tag Creation

The Workspace ONE UEM tool has a concept of device tagging - this allows admins to give extra metadata about the device and use that as part of a smart group assignment criteria.

Here is the link to the VMware documentation regarding device tags: VMware UEM Tags Overview

For our walkthrough today, we are going to create a Tag in the admin console, get the tag ID via the UEM API for use in the next step of the integration. 

Begin by logging into your Workspace ONE UEM Console

Workspace ONE UEM APIs

At this point we have nearly all of the building blocks to assemble our integration. In the next steps we will build out our API calls so we understand how the 2 systems are talking to each other.

In the next steps, we will get familiar with using the Workspace ONE API explorer. We will begin by listing out the tags that exist in our Workspace ONE UEM environment and get their details - we are interested in the tag ID. 

The second step will be to get familiar with the API to assign devices to tags. That will help us form our API in Service now. 

Lets begin with Getting the Tag details for our environment

Select the MDM (Mobile Device Management) REST API V1 module

Scroll down to the Tags section

Scroll down to the parameters section 

If your credentials, api key and organization group code are all correct, you should get a response containing the tags that have been created in your Workspace ONE UEM tool. 

The next step is to understand how to use assign devices and tags via the API

In the tagid field, enter the tag value we got from the previous step

Because this API option supports a bulk load of data, we have to do some special formatting 

Here is an example of what to enter into the field - update the 12345 value with your Device ID we captured during our prep work

{

"bulkValues": {

"Value": [

"12345"

]

}

}

Just like the other API you will see a response below. If all went according to plan you should see a pretty simple response indicating the number of devices that the tag was applied to - in my case, 1

Great! At this point we have veified we have everything we need to complete our integration with ServiceNow

ServiceNOW integration Overview

To complete the integration and send an API request from ServiceNow back to our UEM instance with the device tag information we want to apply, there are 2 things we need to create in service now. First we are going to create a new outbound REST message web service, this will allow us to send over the device information and the tag we want to apply. The second thing we will configure is a Business rule, that is watching the Computers status, and if it changes to fire off the REST message to update a device in the UEM console. 

Servicenow Outbound REST API Message

In this section we will be going though the API configuration to update the records in the UEM console 

In this case the endpoint we are going to use is the URL for the add device tag we tested and noted in the UEM explorer previously. 

Select a authentication profile, if you don't have one for the Workspace ONE UEM API, lets create one. 

We will need a POST type method to send our tag update request, so lets hit New

Header Name: Content-Type , Value: application/json

Header Name: Accept , Value: application/json

Header Name: aw-tenant-code , Value: Set to your API key 

{

"bulkValues": {

"Value": [

"12345"

]

}

}

A test run of the API command will be executed and the status displayed - if you have the Tag ID correct, device ID correct, and API Key, API Username / Password all correct, you will see a success status, like we did in the UEM api explorer. If not - double check the error message and your configurations for those items.


ServiceNow Business Rule Creation

Now that we have our Outbound REST message configured, we need to configure the rules engine to trigger the message to be sent on an action in the ServiceNow console. In our case, there is device status that we will change, and that status change will be the trigger to update the device description as well as sent the API message which will add a device tag in the UEM console.

r.setStringParameterNoEscape('UEMDeviceID', '12345');

to

r.setStringParameterNoEscape('UEMDeviceID', current.correlation_id);

(quick hint that tripped me up, notice the lack of quotes around the current.correlation_id).

Right click and Save in the title bar


Great work! We have now configured ServiceNow to automatically update UEM anytime a device moves into the Pending Repair State! our integration is working and complete. 

What next!?

At this point we have created a full round trip integration between Workspace ONE UEM, Workspace ONE Intelligence, and ServiceNow. From here, you would probably want to create a few more business rules and API sets to remove or update the tags or other data bits as the devices move though their lifecycle. In the Workspace ONE UEM console, now that we are using the tags to match device status, we can use the tags as part of our SmartGroups, so that while devices are out for repair or other condition, we are adjusting the policy and app configurations to match. 

Now that have done it once, the rest is easy!