ServiceNow is a cloud-based platform designed for IT service management.
Torq enables quick and easy integration with ServiceNow so that you can automate anything and everything within moments. Torq's public ServiceNow steps include:
Attach File to Incident
Create Incident
Assign Group to Incident
Get incident details
+13 more...
If you don't see a step you need, you can create your own in various ways, such as using the Send an HTTP Request step or Torq’s Step Builder, and share it across your organization.
Use ServiceNow to Trigger Workflows in Torq
Step One: Create a ServiceNow Trigger Integration in Torq
Navigate to Integration: Go to Build > Integrations > Triggers > ServiceNow and click Add Instance.
Fill in the Details:
Give the integration a unique and meaningful name.
Under Authentication Headers, click Add.
Give the secret a name.
Click Generate Random Secret.
Finalize: Click Add.
Step Two: Create a Business Rule in ServiceNow
Navigate to Business Rules: Go to All > System Definition > Business Rules and in the top right of the page, click New.
Create a Business rule: Fill in the relevant details for your rule:
General Section:
Give your rule a logical name.
In the Table dropdown, select the table containing the activity you want to trigger your workflow (for example, Incident [incident]).
Select the Advanced checkbox.
When to run tab:
In the When dropdown, select after.
In the list of checkboxes on the right, select the relevant options for the events you want to send to Torq (insert/update/delete).
Advanced tab:
Enter the sample code below, customize it to meet your needs, or use your organization's code in the code box to send to a webhook.
(function executeRule(current, previous /*null when async*/) {
try {
var r = new sn_ws.RESTMessageV2();
// Enter your Torq trigger URL
r.setEndpoint("WEBHOOK_URL");
// Enter your auth header information here
r.setRequestHeader("MY HEADER NAME HERE","MY SECRET HERE");
r.setHttpMethod("post");
// Get user and email
var usr = new GlideRecord('sys_user');
usr.get('sys_id', current.getValue("caller_id"));
var reported_by_email = usr.getValue('email');
// Prep Values to Json
var number = current.getValue("number");
var opened_at = current.getValue("opened_at");
var impact = current.getValue("impact");
var urgency = current.getValue("urgency");
var short_description = current.getValue("short_description");
var description = current.getValue("description");
var category = current.getValue("category");
var priority = current.getValue("priority");
var sys_id = current.getValue("sys_id");
var subcategory = current.getValue("subcategory");
var state = current.getValue("state");
var obj = { "number": number, "reported_by_email": reported_by_email, "opened_at": opened_at, "impact": impact, "urgency": urgency, "short_description": short_description, "description": description, "category": category, "priority": priority, "sys_id": sys_id, "subcategory": subcategory, "state": state };
var body = JSON.stringify(obj);
gs.info("Webhook body: " + body);
r.setRequestBody(body);
var response = r.execute();
var httpStatus = response.getStatusCode();
}
catch (ex) {
var message = ex.message;
gs.error("Error message: " + message);
}
gs.info("Webhook target HTTP status response: " + httpStatus);
})(current, previous);Replace WEBHOOK_URL with the webhook URL you created in Torq in step one.
Finalize: Click Submit.
Now that you've successfully created a ServiceNow trigger, you can build your first ServiceNow-initiated workflow!
In Torq, go to Build > Workflows > Create a Workflow > New Blank Workflow, and select the trigger type: Integrations > ServiceNow. Find your new trigger, and automate away!
Use ServiceNow Steps in Torq
Torq offers two separate methods for integrating with ServiceNow:
User-based integration: a service account with configured username and password stored in Torq for integration authentication.
Open Authentication (OAuth)-based integration: Torq utilizes an Open industry-standard protocol for secure authorization to ServiceNow. OAuth is a token-based mechanism whereby the actual credentials are not stored in Torq.
Follow the instructions applicable to your chosen method below.
Create a ServiceNow User-based Integration
Step One: Create a Dedicated User in ServiceNow
It is best practice to add a new user to your ServiceNow account to create a dedicated user for the integration.
Navigate to User Groups: Go to System Security > Users and Groups > Users and in the top right of the page, click New.
Define New User:
Enter the user details:
User ID
Select Web service access only.
Password needs reset must be unselected.
Finalize: Click Submit.
Set User Properties: Search for the new user in the list and click the name to edit its properties.
Step Two: Create a ServiceNow Steps Integration in Torq
Navigate to Integration: Go to Build > Integrations > Steps > ServiceNow and click Add Instance.
Fill in the Details: Give the integration a unique and meaningful name.
ServiceNow Instance: Enter your ServiceNow instance.
ServiceNow Username: Enter the ServiceNow User ID that you created in step one (2a.).
ServiceNow Password: enter the ServiceNow password that you generated in step one (4a.).
Test: Click Test Integration to verify the integration is configured correctly.
Finalize: Click Add.
Create a ServiceNow Integration Using Open Authentication (OAuth 2.0)
Step One: Create an OAuth Integration in Torq
Navigate to Integration: Go to Build > Integrations > ServiceNow OAuth and click Add Instance.
Fill in the Details: Give the integration a unique and meaningful name.
Step Two: Create a ServiceNow Application
Navigate to Application Registry: In ServiceNow, go to System OAuth > Application Registry.
Create a New Application: Select Create an OAuth API endpoint for external clients.
Configure the Application: Fill in the details for the following fields:
Give the application a unique and meaningful name
Redirect URL:
Unlock the Redirect URL field.
Enter the applicable Torq callback URL from step 1 above:
US deployments:
https://redir.torq.io/integrations/servicenow_oauth_token
EU deployments:
https://redir.eu.torq.io/integrations/servicenow_oauth_token
Lock the Redirect URL field.
Check the Active box.
Optionally, add the Torq Logo URL:
Unlock the Logo URL field.
Enter a valid Logo URL. For example,
https://torq.io/wp-content/uploads/2023/04/Torq-Logo-Black.svg
Lock the Logo URL field.
Finalize: Click Submit.
Generate Application Secret: Search for the new application in the list and click on it to access the generated client secret.
Unlock the Client Secret field to view and copy the client secret.
Save the automatically generated ClientID and Client Secret to use in Torq.
Finalize: Click Update.
Step Three: Complete the OAuth Integration in Torq
Navigate to Integration: Go back to the Torq integration you began creating in step 1.
Fill in the Details:
ServiceNow Auth URL:
This is pre-populated with
https://<INSTANCE>.service-now.com/oauth_auth.do
.Replace this value with the applicable endpoint for your specific ServiceNow instance. For example,
https://dev305722.service-now.com/oauth_auth.do
wheredev305722
is the instance.
ServiceNow Token URL:
This is prepopulated with
https://<INSTANCE>.service-now.com/oauth_token.do
.Replace this value with the applicable endpoint for your specific ServiceNow instance. For example,
https://dev305722.service-now.com/oauth_token.do
wheredev305722
is the instance.
ServiceNow Instance: Enter your instance name. For example,
dev305722
.Client ID: enter the ClientID generated in step two (4.).
Client Secret: enter the Client Secret generated in step two (4.).
If you have any Scopes defined in the ServiceNow application, list them in a comma-separated list.
Finalize: Click Continue. This will begin the OAuth token generation sequence.
Templates
Now that you've added your integrations check out these specially crafted templates by Torq's security experts. Visit Torq's template library for more.