All Collections
Integrations
Data Push Destinations Example Using ServiceNow
Data Push Destinations Example Using ServiceNow

Send UXI data to your ServiceNow instance

M
Written by Mandar Ghogale
Updated over a week ago

Selecting the Generic HTTP Endpoint destination will send your test result data or issue data to your HTTP Endpoint database. For example, we are going to look at the ServiceNow instance. In addition, you can do more things in this SNOW scripted REST API like if the sensor is part of this group and reporting this type of issue, assign it to this team, etc, or assign different priorities for the issues. For example, maybe you care more about your own application than you do about some other app.

To get started with the UXI Data Push Destination for Generic HTTP Endpoint(SNOW):

  1. Navigate to Scripted REST API

  2. Create your API

    • Click on the new button to start creating your API

    • Give your API a name and an ID

    • Click on the submit button to save this API

  3. Select your API and create a new unauthenticated resource

    • After creating your API, you are redirected to a list of APIs.

    • Search for your API and select your API

    • Create a new resource by clicking on the new button at the bottom of the page.

4. Use the script below as a template

This example shows how to create a POST request. We will be using it to post an alert. The alert details are contained in

request.body.data.text

5. Final script for REST API:

(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
gs.info(request.body.data);
var issues = request.body.data;
for (item=0; item<issues.length; item++){
var issue_uid = issues[item].uid;
var issue_code = issues[item].code;
var issue_snow_id = issue_code+'_'+issue_uid;
var issue_severity = issues[item].severity;
var issue_status = issues[item].status;
var issue_timestamp = issues[item].timestamp;
var issue_work_notes = issues[item];
var inc = new GlideRecord('incident');
if (issue_status == 'CONFIRMED') {
inc.initialize();
inc.work_notes = JSON.stringify(issue_work_notes);
inc.short_description = issue_snow_id; // set this to identify the incident later for resolved messages
inc.insert();
gs.info('Incident created');

} else if (issue_status == 'RESOLVED') {
inc.get("short_description", issue_snow_id);
inc.state = 7;
inc.update();
gs.info('Incident closed');
}
}
return {
"status": "PROCESSED"
};
}
)(request, response);


โ€‹6. Once this is done, in the UXI dashboard, go to Settings > Integrations. In the Data Push Destinations section, click on the Add Destination button.

7. Specify the following information from the Add Destination modal that appears:

  • Data Type: Test Results or Issues

  • Destination Type: Generic HTTP Endpoint

  • Name: Give this integration a friendly name

  • URL: Enter the ServiceNow public URL = ServiceNow instance URL + Base API path

  • Username: Provide a username for the ServiceNow user the data push destination will use to add documents

  • Password: Enter the password for the ServiceNow user the data push destination will use to add documents

    8. Click on the Add button.

    Here is a short demo setting up the data push destination for ServiceNow

Did this answer your question?