ServiceNow - Outbound REST with a Business Rule
Using ServiceNow (SNOW) Outbound REST and Business Rules with SnapLogic. This document defines the steps required to create a Business Rule and REST Endpoint in ServiceNow that will call a SnapLogic pipeline. Business rules allow the user to define conditions that will trigger an Outbound REST Message when an expression or expressions are evaluated. Using the sample pipeline as a template create a pipeline and triggered task (associating your SNOW account with the ServiceNow Query snap). NOTE – 1: this pipeline is setup to accept a POST and is ASYNC – sending back just the RUUID though no additional processing is done against it in SNOW once returned NOTE – 2: A pipeline parameter called ‘Inc_Number’ has been setup and is used in the query snap Copy the Bearer Token and URL for use the newly created task: Next create an Outbound REST Message in ServiceNow. Go to SNOW and type “REST” in the Navigator Search Under ‘Outbound’ click ‘REST Message’ Create a New Message, pointing to the triggered URL + “?” + QueryParams NOTE: You will need to remember the Name (eg. EB – Snaplogi – Send Incident) and variable (ex. ${IncidentNumber}) as both will be used during the script process for the business rule This should create the HTTP Methods for you – I have POST only but you could also use other methods as needed based on the use case. GET would have also worked in this scenario since I’m only passing Query Parameters to the endpoint The Next step is to create a Business Rule which references the created REST (under System Definition) Setup a new business rule select the table / SNOW Object (eg. Incident) Because we are scripting the REST call, you’ll need to select “Advanced” in the top section select desired ‘When to run’ options (eg. before / insert / update / delete) and any filter conditions needed In the Advanced area on the bottom, you’ll need to add in the following script, substituting your specific values from above for the RESTMessageName and VARIABLE_NAME function onBefore(current, previous) { //This function will be automatically called when this rule is processed. var incnum =current.number; var r = new RESTMessage('<RESTMessageName>', 'post'); r.setStringParameter('<VARIABLE_NAME>',incnum); var response = r.execute(); } Done! Test the rule by editing an Incident in ServiceNow and seeing if the pipeline was triggered. Here is a dashboard view of the pipeline execution: And the file created in the middle SNOW Query Path:9.6KViews0likes0CommentsServiceNow to Slack, Incident Details
Created by @tlui This pipeline is configured as a triggered pipeline with which a single ServiceNow number may be passed in. The details of that ServiceNow incident are then posted to Slack. Configuration Prerequisite : Setup Slack Webhooks - Sending messages using Incoming Webhooks | Slack This pattern was created using ServiceNow London Version. The ServiceNow Query may be enhanced for customization and the routers can be reconfigured per customer use case. Sources : ServiceNow tickets Targets : Slack message Snaps used : ServiceNow Query, Mapper, Group by N, REST Post Downloads ServiceNow to Slack, Incident Details.slp (9.5 KB)3.9KViews0likes0CommentsCreate request ticket in ServiceNow when employee in Workday joins
Created by @ckonduru SnapLogic gets triggered off a new hire in Workday, then SnapLogic will create a request in ServiceNow. SnapLogic creates an empty request in ServiceNow, then SnapLogic/ServiceNow sends email with link to ticket to manager. Manager then fills in the details for the ticket and submits it. Configuration Sources: Workday Targets: ServiceNow Snaps used: JSON Generator, XML Parser, JSON Formatter, JSON Parser, JSON Splitter, Group By N, Mapper, Workday Read, ServiceNow Insert, Email Sender Downloads Workday_To_ServiceNow_NewHire_CreateRequest_Link_To_Manager.slp (24.8 KB)3.7KViews0likes0CommentsServiceNow to Slack, 10 Recent Requested Approvals
Created by @tlui This pipeline takes all ServiceNow approvals and takes the 10 most recent approvals in “requested” state to then send to Slack. Configuration Prerequisite : Setup Slack Webhooks - Sending messages using Incoming Webhooks | Slack This pattern was created using ServiceNow London Version. The ServiceNow Query may be enhanced for customization and the routers can be reconfigured per customer use case. Sources : ServiceNow tickets Targets : Slack message Snaps used : ServiceNow Query, Router, Mapper, Sort, Head, Group by N, REST Post Downloads ServiceNow to Slack, 10 Recent Requested Approvals.slp (13.2 KB)3.6KViews0likes0CommentsCreating a ServiceNow Incident from a JIRA Issue
Contributed by @rdharnikota This pipeline gets the details of a specified JIRA issue and creates an incident in ServiceNow. Configuration The first Mapper maps the JIRA issue ID and the issue comments to the ServiceNow incident. Other fields are also manually set in the Mapper. Either update the values or map the fields that you need to carry over. Sources: JIRA issue Targets: ServiceNow incident Snaps used: JIRA Get, Mapper, Router, ServiceNow Insert, ServiceNow Update Downloads Create SNOW Incident from JIRA.slp (8.8 KB)3.4KViews0likes0CommentsCreate Box folders for ServiceNow Service Requests
Created by @skatpally A service request is created in ServiceNow. SnapLogic creates a folder in Box with the ServiceNow request’s number as the folder name, if it doesn’t already exist. SnapLogic creates a shared link to the Box folder Configuration Sources: ServiceNow service request Targets: Box folder Snaps used: ServiceNow Query, Mapper, Box Directory Browser, Router, Box Add Folder, REST Put Downloads Create_Box_folders_for_ServiceNow_service_requests.slp (12.0 KB)3.4KViews0likes0CommentsCreate Request Ticket in ServiceNow and Send Email
Created by @ckonduru SnapLogic creates an empty request in ServiceNow, then SnapLogic sends an email containing a link to the ticket to manager. The manager then fills in the details for the ticket and submits it. A separate triggered task needs to be created if Active Directory or a designated database is the central place to host all employees. With the additional triggered task, when a new employee is added to Active Directory or a designated database, then SnapLogic will create a request in ServiceNow using this pipeline. Configuration Sources: None, or data sent to a triggered task. Targets: ServiceNow, Email Snaps used: Mapper, ServiceNow Insert, Email Sender Downloads CreateServiceNowEmptyRequest_LinktoManager.slp (6.9 KB)3.4KViews0likes0CommentsServiceNow to Slack, 10 Recent High Priority Open Incidents
Created by @tlui This pipeline takes ServiceNow incidents from the past 5 months and will filter for Open and Critical items. It will then take the most recent 10 items and post to Slack. Configuration Prerequisite : Setup Slack Webhooks - Sending messages using Incoming Webhooks | Slack This pattern was created using ServiceNow London Version. The ServiceNow Query may be enhanced for customization and the routers can be reconfigured per customer use case. Sources : ServiceNow tickets Targets : Slack message Snaps used : ServiceNow Query, Router, Mapper, Sort, Head, Group by N, REST Post Downloads ServiceNow to Slack, High Priority Open Incidents.slp (16.5 KB)3.3KViews0likes0CommentsCreation of Users in ServiceNow through Approval Process in Workday
Created by @skatpally When there is a new/updated employee in Workday, create employee in ServiceNow if admin approves his application via People’s Task. Configuration Sources: XML File, Workday Targets: ServiceNow Snaps used: File Reader, XML Parser, JSON Splitter, Mapper, Filter, Workday Read, ServiceNow Insert Downloads New-Hire-WKDY-to-SNOW.slp (16.4 KB)3.1KViews0likes0CommentsServiceNow to Slack, 10 Recent Open Tickets
Created by @tlui This pipeline takes all ServiceNow tickets and takes the 10 most recent open tickets to then send to Slack. Configuration Prerequisite: Setup Slack Webhooks - Sending messages using Incoming Webhooks | Slack This pattern was created using ServiceNow London Version. The ServiceNow Query may be enhanced for customization and the routers can be reconfigured per customer use case. Sources: ServiceNow tickets Targets: Slack message Snaps used: ServiceNow Query, Router, Mapper, Sort, Head, Group by N, REST Post Downloads ServiceNow to Slack, 10 Recent Open Tickets.slp (13.1 KB)2.9KViews0likes0Comments