automation-hub
2021.10
false
UiPath logo, featuring letters U and I in white
OUT OF SUPPORT

Automation Hub API Guide

Automation CloudAutomation Cloud Public SectorAutomation Suite
Last updated Nov 11, 2024

Service Now Outbound Integration Video Tutorial

Short description:This video presents how to achieve a basic integration between Service Now and Automation Hub, by using the Open API and triggering Idea creation from Service Now Tickets.

The main topics are:

  • 00:00 - Intro;

  • 01:30 - Setting up custom fields for Automation Hub questionnaire in the incident table;

  • 05:40 - Setting up the business rule that performs the API call to Automation Hub;

  • 10:50 - Creating a new incident and testing the rule;

  • 13:10 - Checking the output directly in Automation Hub.

Code Used in the Service Now Configuration

var params = {
    "process_name": current.getDisplayValue()+" - "+current.short_description.toString(),
    "process_description": current.short_description.toString(),
    "category_id": parseInt(current.u_ah_business_area),
    "rules": parseInt(current.u_ah_how_rule_based_is_your_task),
    "input_type": parseInt(current.u_ah_how_would_you_describe_the_input_data_for_your_task_process),
    "input_quality": parseInt(current.u_ah_how_would_you_describe_the_structure_of_your_input_data),
    "stability": parseInt(current.u_ah_changes_in_the_next_6_months),
    "documentation": parseInt(current.u_ah_documentation_type),
    "owner": current.u_ah_process_owner.toString()
};
	
var json = new JSON();
var text = json.encode(params);
	
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://rpanavigator-pentest-open-api.azurewebsites.net/api/v1/openapi/automationidea');
request.setHttpMethod('POST');
request.setRequestHeader("Accept","application/json");
request.setRequestHeader("Content-Type","application/json");
request.setRequestHeader("x-ah-openapi-app-key","userapi");
request.setRequestHeader("x-ah-openapi-auth","openapi-token");
request.setRequestHeader("Authorization","Bearer 4ec2bd1f-af111111111111111/411497b2-cfa3-454d-1111111111111");
request.setRequestBody(text);
	
var requestBody = request.getRequestBody();
var response = request.execute();
var responseBody = response.getBody();
var responseObj = JSON.parse(responseBody);
var tenantURL = 'https://preprod-automation-hub.uipath.com/integrations_change/';
current.description = current.description+"  /Info from Automation Hub:/"+responseObj.statusCode+"  "+responseObj.message+"//Process url: "+tenantURL+responseObj.data.process_slug+"//Process name:"+responseObj.data.process_name;
current.update();
gs.log(response.getBody());var params = {
    "process_name": current.getDisplayValue()+" - "+current.short_description.toString(),
    "process_description": current.short_description.toString(),
    "category_id": parseInt(current.u_ah_business_area),
    "rules": parseInt(current.u_ah_how_rule_based_is_your_task),
    "input_type": parseInt(current.u_ah_how_would_you_describe_the_input_data_for_your_task_process),
    "input_quality": parseInt(current.u_ah_how_would_you_describe_the_structure_of_your_input_data),
    "stability": parseInt(current.u_ah_changes_in_the_next_6_months),
    "documentation": parseInt(current.u_ah_documentation_type),
    "owner": current.u_ah_process_owner.toString()
};
	
var json = new JSON();
var text = json.encode(params);
	
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://rpanavigator-pentest-open-api.azurewebsites.net/api/v1/openapi/automationidea');
request.setHttpMethod('POST');
request.setRequestHeader("Accept","application/json");
request.setRequestHeader("Content-Type","application/json");
request.setRequestHeader("x-ah-openapi-app-key","userapi");
request.setRequestHeader("x-ah-openapi-auth","openapi-token");
request.setRequestHeader("Authorization","Bearer 4ec2bd1f-af111111111111111/411497b2-cfa3-454d-1111111111111");
request.setRequestBody(text);
	
var requestBody = request.getRequestBody();
var response = request.execute();
var responseBody = response.getBody();
var responseObj = JSON.parse(responseBody);
var tenantURL = 'https://preprod-automation-hub.uipath.com/integrations_change/';
current.description = current.description+"  /Info from Automation Hub:/"+responseObj.statusCode+"  "+responseObj.message+"//Process url: "+tenantURL+responseObj.data.process_slug+"//Process name:"+responseObj.data.process_name;
current.update();
gs.log(response.getBody());

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.