ServiceNow
Port's ServiceNow integration allows you to model ServiceNow resources in your software catalog and ingest data into them.
Overview
This integration allows you to:
- Map and organize your desired ServiceNow resources and their metadata in Port (see supported resources below).
Supported Resources
The resources that can be ingested from ServiceNow into Port are listed below.
User
- (<your-servicenow-url>/api/now/table/sys_user_group
)Service Catalog
- (<your-servicenow-url>/api/now/table/sc_catalog
)Incident
- (<your-servicenow-url>/api/now/table/incident
)
Setup
Choose one of the following installation methods:
- Hosted by Port
- Real-time (self-hosted)
- Scheduled (CI)
Using this installation option means that the integration will be hosted by Port, with a customizable resync interval to ingest data into Port.
The Hosted by Port
option is currently in beta, and is still undergoing final testing before its official release.
Should you encounter any bugs or functionality issues, please let us know so we can rectify them as soon as possible.
Your help is greatly appreciated! ⭐
Live event support
Currently, live events are not supported for integrations hosted by Port.
Resyncs will be performed periodically every 1 hour by default (can be configured differently after installation), or manually triggered by you via Port's UI.
Therefore, real-time events (including GitOps) will not be ingested into Port immediately.
Support for live events is WIP and will be supported in the near future.
Installation
To install, follow the following steps:
-
Go to the Data sources page of your portal.
-
Click on the
+ Data source
button in the top-right corner. -
Click on the relevant integration in the list.
-
Under
Select your installation method
, chooseHosted by Port
. -
Configure the
integration settings
andapplication settings
as you wish (see below for details).
Application settings
Every integration hosted by Port has the following customizable application settings, which are configurable after installation:
-
Resync interval
: The frequency at which Port will ingest data from the integration. There are various options available, ranging from every 1 hour to once a day. -
Send raw data examples
: A boolean toggle (enabled
by default). If enabled, raw data examples will be sent from the integration to Port. These examples are used when testing your mapping configuration, they allow you to run yourjq
expressions against real data and see the results.
Integration settings
Every integration has its own tool-specific settings, under the Integration settings
section.
Each of these settings has an ⓘ icon next to it, which you can hover over to see a description of the setting.
Port secrets
Some integration settings require sensitive pieces of data, such as tokens.
For these settings, Port secrets will be used, ensuring that your sensitive data is encrypted and secure.
When changing such a setting, you will be prompted to choose an existing secret or create a new one:
Port source IP addresses
When using this installation method, Port will make outbound calls to your 3rd-party applications from static IP addresses.
You may need to add these addresses to your allowlist, in order to allow Port to interact with the integrated service:
- Europe (EU)
- United States (US)
54.73.167.226
63.33.143.237
54.76.185.219
3.234.37.33
54.225.172.136
3.225.234.99
Using this installation option means that the integration will be able to update Port in real time using webhooks.
Prerequisites
To install the integration, you need a Kubernetes cluster that the integration's container chart will be deployed to.
Please make sure that you have kubectl
and helm
installed on your machine, and that your kubectl
CLI is connected to the Kubernetes cluster where you plan to install the integration.
If you are having trouble installing this integration, please refer to these troubleshooting steps.
For details about the available parameters for the installation, see the table below.
- Helm
- ArgoCD
To install the integration using Helm:
-
Go to the Servicenow data source page in your portal.
-
Select the
Real-time and always on
method: -
A
helm
command will be displayed, with default values already filled out (e.g. your Port cliend ID, client secret, etc).
Copy the command, replace the placeholders with your values, then run it in your terminal to install the integration.
The baseUrl
, port_region
, port.baseUrl
, portBaseUrl
, port_base_url
and OCEAN__PORT__BASE_URL
parameters are used to select which instance or Port API will be used.
Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.
- If you use the EU region of Port (https://app.getport.io), your API URL is
https://api.getport.io
. - If you use the US region of Port (https://app.us.getport.io), your API URL is
https://api.us.getport.io
.
To install the integration using ArgoCD:
- Create a
values.yaml
file inargocd/my-ocean-servicenow-integration
in your git repository with the content:
Remember to replace the placeholders for SERVICENOW_URL
SERVICENOW_USERNAME
and SERVICENOW_PASSWORD
.
initializePortResources: true
scheduledResyncInterval: 120
integration:
identifier: my-ocean-servicenow-integration
type: servicenow
eventListener:
type: POLLING
config:
servicenowUrl: SERVICENOW_URL
servicenowUsername: SERVICENOW_USERNAME
secrets:
servicenowPassword: SERVICENOW_PASSWORD
- Install the
my-ocean-servicenow-integration
ArgoCD Application by creating the followingmy-ocean-servicenow-integration.yaml
manifest:
Remember to replace the placeholders for YOUR_PORT_CLIENT_ID
YOUR_PORT_CLIENT_SECRET
and YOUR_GIT_REPO_URL
.
Multiple sources ArgoCD documentation can be found here.
ArgoCD Application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-ocean-servicenow-integration
namespace: argocd
spec:
destination:
namespace: my-ocean-servicenow-integration
server: https://kubernetes.default.svc
project: default
sources:
- repoURL: 'https://port-labs.github.io/helm-charts/'
chart: port-ocean
targetRevision: 0.1.14
helm:
valueFiles:
- $values/argocd/my-ocean-servicenow-integration/values.yaml
parameters:
- name: port.clientId
value: YOUR_PORT_CLIENT_ID
- name: port.clientSecret
value: YOUR_PORT_CLIENT_SECRET
- name: port.baseUrl
value: https://api.getport.io
- repoURL: YOUR_GIT_REPO_URL
targetRevision: main
ref: values
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
The baseUrl
, port_region
, port.baseUrl
, portBaseUrl
, port_base_url
and OCEAN__PORT__BASE_URL
parameters are used to select which instance or Port API will be used.
Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.
- If you use the EU region of Port (https://app.getport.io), your API URL is
https://api.getport.io
. - If you use the US region of Port (https://app.us.getport.io), your API URL is
https://api.us.getport.io
.
- Apply your application manifest with
kubectl
:
kubectl apply -f my-ocean-servicenow-integration.yaml
This table summarizes the available parameters for the installation.
Parameter | Description | Required |
---|---|---|
port.clientId | Your Port client id (How to get the credentials) | ✅ |
port.clientSecret | Your Port client secret (How to get the credentials) | ✅ |
port.baseUrl | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | ✅ |
integration.identifier | Change the identifier to describe your integration | ✅ |
integration.config.servicenowUsername | The ServiceNow account username | ✅ |
integration.secrets.servicenowPassword | The ServiceNow account password | ✅ |
integration.config.servicenowUrl | The ServiceNow instance URL. For example https://example-id.service-now.com | ✅ |
integration.eventListener.type | The event listener type. Read more about event listeners | ✅ |
integration.type | The integration to be installed | ✅ |
scheduledResyncInterval | The number of minutes between each resync. When not set the integration will resync for each event listener resync event. Read more about scheduledResyncInterval | ❌ |
initializePortResources | Default true, When set to true the integration will create default blueprints and the port App config Mapping. Read more about initializePortResources | ❌ |
sendRawDataExamples | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | ❌ |
For advanced configuration such as proxies or self-signed certificates, click here.
This workflow/pipeline will run the ServiceNow integration once and then exit, this is useful for scheduled ingestion of data.
If you want the integration to update Port in real time using webhooks you should use the Real-time (self-hosted) installation option
- GitHub
- Jenkins
- Azure Devops
- GitLab
Make sure to configure the following Github Secrets:
Parameter | Description | Required |
---|---|---|
OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME | The ServiceNow account username | ✅ |
OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD | The ServiceNow account password | ✅ |
OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL | The ServiceNow instance URL | ✅ |
OCEAN__INITIALIZE_PORT_RESOURCES | Default true, When set to false the integration will not create default blueprints and the port App config Mapping | ❌ |
OCEAN__SEND_RAW_DATA_EXAMPLES | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | ❌ |
OCEAN__INTEGRATION__IDENTIFIER | Change the identifier to describe your integration, if not set will use the default one | ❌ |
OCEAN__PORT__CLIENT_ID | Your Port client id (How to get the credentials) | ✅ |
OCEAN__PORT__CLIENT_SECRET | Your Port client secret (How to get the credentials) | ✅ |
OCEAN__PORT__BASE_URL | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | ✅ |
Here is an example for servicenow-integration.yml
workflow file:
name: ServiceNow Exporter Workflow
on:
workflow_dispatch:
schedule:
- cron: '0 */1 * * *' # Determines the scheduled interval for this workflow. This example runs every hour.
jobs:
run-integration:
runs-on: ubuntu-latest
timeout-minutes: 30 # Set a time limit for the job
steps:
- uses: port-labs/ocean-sail@v1
with:
type: 'servicenow'
port_client_id: ${{ secrets.OCEAN__PORT__CLIENT_ID }}
port_client_secret: ${{ secrets.OCEAN__PORT__CLIENT_SECRET }}
port_base_url: https://api.getport.io
config: |
servicenow_username: ${{ secrets.OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME }}
servicenow_password: ${{ secrets.OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD }}
servicenow_url: ${{ secrets.OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL }}
Your Jenkins agent should be able to run docker commands.
Make sure to configure the following Jenkins Credentials
of Secret Text
type:
Parameter | Description | Required |
---|---|---|
OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME | The ServiceNow account username | ✅ |
OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD | The ServiceNow account password | ✅ |
OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL | The ServiceNow instance URL | ✅ |
OCEAN__INITIALIZE_PORT_RESOURCES | Default true, When set to false the integration will not create default blueprints and the port App config Mapping | ❌ |
OCEAN__SEND_RAW_DATA_EXAMPLES | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | ❌ |
OCEAN__INTEGRATION__IDENTIFIER | Change the identifier to describe your integration, if not set will use the default one | ❌ |
OCEAN__PORT__CLIENT_ID | Your Port client id (How to get the credentials) | ✅ |
OCEAN__PORT__CLIENT_SECRET | Your Port client secret (How to get the credentials) | ✅ |
OCEAN__PORT__BASE_URL | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | ✅ |
Here is an example for Jenkinsfile
groovy pipeline file:
pipeline {
agent any
stages {
stage('Run ServiceNow Integration') {
steps {
script {
withCredentials([
string(credentialsId: 'OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME', variable: 'OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME'),
string(credentialsId: 'OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD', variable: 'OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD'),
string(credentialsId: 'OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL', variable: 'OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL'),
string(credentialsId: 'OCEAN__PORT__CLIENT_ID', variable: 'OCEAN__PORT__CLIENT_ID'),
string(credentialsId: 'OCEAN__PORT__CLIENT_SECRET', variable: 'OCEAN__PORT__CLIENT_SECRET'),
]) {
sh('''
#Set Docker image and run the container
integration_type="servicenow"
version="latest"
image_name="ghcr.io/port-labs/port-ocean-${integration_type}:${version}"
docker run -i --rm --platform=linux/amd64 \
-e OCEAN__EVENT_LISTENER='{"type":"ONCE"}' \
-e OCEAN__INITIALIZE_PORT_RESOURCES=true \
-e OCEAN__SEND_RAW_DATA_EXAMPLES=true \
-e OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME=$OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME \
-e OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD=$OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD \
-e OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL=$OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL \
-e OCEAN__PORT__CLIENT_ID=$OCEAN__PORT__CLIENT_ID \
-e OCEAN__PORT__CLIENT_SECRET=$OCEAN__PORT__CLIENT_SECRET \
-e OCEAN__PORT__BASE_URL='https://api.getport.io' \
$image_name
exit $?
''')
}
}
}
}
}
}
Your Azure Devops agent should be able to run docker commands. Learn more about agents here.
Variable groups store values and secrets you'll use in your pipelines across your project. Learn more
Setting Up Your Credentials
- Create a Variable Group: Name it port-ocean-credentials.
- Store the required variables (see the table below).
- Authorize Your Pipeline:
- Go to "Library" -> "Variable groups."
- Find port-ocean-credentials and click on it.
- Select "Pipeline Permissions" and add your pipeline to the authorized list.
Parameter | Description | Required |
---|---|---|
OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME | The ServiceNow account username | ✅ |
OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD | The ServiceNow account password | ✅ |
OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL | The ServiceNow instance URL | ✅ |
OCEAN__INITIALIZE_PORT_RESOURCES | Default true, When set to false the integration will not create default blueprints and the port App config Mapping | ❌ |
OCEAN__SEND_RAW_DATA_EXAMPLES | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | ❌ |
OCEAN__INTEGRATION__IDENTIFIER | Change the identifier to describe your integration, if not set will use the default one | ❌ |
OCEAN__PORT__CLIENT_ID | Your Port client id (How to get the credentials) | ✅ |
OCEAN__PORT__CLIENT_SECRET | Your Port client secret (How to get the credentials) | ✅ |
OCEAN__PORT__BASE_URL | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | ✅ |
Here is an example for servicenow-integration.yml
pipeline file:
trigger:
- main
pool:
vmImage: "ubuntu-latest"
variables:
- group: port-ocean-credentials
steps:
- script: |
# Set Docker image and run the container
integration_type="servicenow"
version="latest"
image_name="ghcr.io/port-labs/port-ocean-$integration_type:$version"
docker run -i --rm --platform=linux/amd64 \
-e OCEAN__EVENT_LISTENER='{"type":"ONCE"}' \
-e OCEAN__INITIALIZE_PORT_RESOURCES=true \
-e OCEAN__SEND_RAW_DATA_EXAMPLES=true \
-e OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME=$(OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME) \
-e OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD=$(OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD) \
-e OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL=$(OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL) \
-e OCEAN__PORT__CLIENT_ID=$(OCEAN__PORT__CLIENT_ID) \
-e OCEAN__PORT__CLIENT_SECRET=$(OCEAN__PORT__CLIENT_SECRET) \
-e OCEAN__PORT__BASE_URL='https://api.getport.io' \
$image_name
exit $?
displayName: 'Ingest Data into Port'
Make sure to configure the following GitLab variables:
Parameter | Description | Required |
---|---|---|
OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME | The ServiceNow account username | ✅ |
OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD | The ServiceNow account password | ✅ |
OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL | The ServiceNow instance URL | ✅ |
OCEAN__INITIALIZE_PORT_RESOURCES | Default true, When set to false the integration will not create default blueprints and the port App config Mapping | ❌ |
OCEAN__SEND_RAW_DATA_EXAMPLES | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true | ❌ |
OCEAN__INTEGRATION__IDENTIFIER | Change the identifier to describe your integration, if not set will use the default one | ❌ |
OCEAN__PORT__CLIENT_ID | Your Port client id (How to get the credentials) | ✅ |
OCEAN__PORT__CLIENT_SECRET | Your Port client secret (How to get the credentials) | ✅ |
OCEAN__PORT__BASE_URL | Your Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US | ✅ |
Here is an example for .gitlab-ci.yml
pipeline file:
default:
image: docker:24.0.5
services:
- docker:24.0.5-dind
before_script:
- docker info
variables:
INTEGRATION_TYPE: servicenow
VERSION: latest
stages:
- ingest
ingest_data:
stage: ingest
variables:
IMAGE_NAME: ghcr.io/port-labs/port-ocean-$INTEGRATION_TYPE:$VERSION
script:
- |
docker run -i --rm --platform=linux/amd64 \
-e OCEAN__EVENT_LISTENER='{"type":"ONCE"}' \
-e OCEAN__INITIALIZE_PORT_RESOURCES=true \
-e OCEAN__SEND_RAW_DATA_EXAMPLES=true \
-e OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME=$OCEAN__INTEGRATION__CONFIG__SERVICENOW_USERNAME \
-e OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD=$OCEAN__INTEGRATION__CONFIG__SERVICENOW_PASSWORD \
-e OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL=$OCEAN__INTEGRATION__CONFIG__SERVICENOW_URL \
-e OCEAN__PORT__CLIENT_ID=$OCEAN__PORT__CLIENT_ID \
-e OCEAN__PORT__CLIENT_SECRET=$OCEAN__PORT__CLIENT_SECRET \
-e OCEAN__PORT__BASE_URL='https://api.getport.io' \
$IMAGE_NAME
rules: # Run only when changes are made to the main branch
- if: '$CI_COMMIT_BRANCH == "main"'
The baseUrl
, port_region
, port.baseUrl
, portBaseUrl
, port_base_url
and OCEAN__PORT__BASE_URL
parameters are used to select which instance or Port API will be used.
Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.
- If you use the EU region of Port (https://app.getport.io), your API URL is
https://api.getport.io
. - If you use the US region of Port (https://app.us.getport.io), your API URL is
https://api.us.getport.io
.
For advanced configuration such as proxies or self-signed certificates, click here.
Configuration
Port integrations use a YAML mapping block to ingest data from the third-party api into Port.
The mapping makes use of the JQ JSON processor to select, modify, concatenate, transform and perform other operations on existing fields and values from the integration API.
Examples
Examples of blueprints and the relevant integration configurations:
Group
Group blueprint
{
"identifier": "servicenowGroup",
"title": "Servicenow Group",
"icon": "Servicenow",
"schema": {
"properties": {
"description": {
"title": "Description",
"type": "string"
},
"isActive": {
"title": "Is active",
"type": "boolean"
},
"createdOn": {
"title": "Created On",
"type": "string",
"format": "date-time"
},
"createdBy": {
"title": "Created By",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {}
}
Integration configuration
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: sys_user_group
selector:
query: "true"
port:
entity:
mappings:
identifier: .sys_id
title: .name
blueprint: '"servicenowGroup"'
properties:
description: .description
isActive: .active
createdOn: '.sys_created_on | (strptime("%Y-%m-%d %H:%M:%S") | strftime("%Y-%m-%dT%H:%M:%SZ"))'
createdBy: .sys_created_by
Service Catalog
Service catalog blueprint
{
"identifier": "servicenowCatalog",
"title": "Servicenow Catalog",
"icon": "Servicenow",
"schema": {
"properties": {
"description": {
"title": "Description",
"type": "string"
},
"isActive": {
"title": "Is Active",
"type": "boolean"
},
"createdOn": {
"title": "Created On",
"type": "string",
"format": "date-time"
},
"createdBy": {
"title": "Created By",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {}
}
Integration configuration
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: sc_catalog
selector:
query: "true"
port:
entity:
mappings:
identifier: .sys_id
title: .title
blueprint: '"servicenowCatalog"'
properties:
description: .description
isActive: .active
createdOn: '.sys_created_on | (strptime("%Y-%m-%d %H:%M:%S") | strftime("%Y-%m-%dT%H:%M:%SZ"))'
createdBy: .sys_created_by
Incident
Incident blueprint
{
"identifier": "servicenowIncident",
"title": "Servicenow Incident",
"icon": "Servicenow",
"schema": {
"properties": {
"category": {
"title": "Category",
"type": "string"
},
"reopenCount": {
"title": "Reopen Count",
"type": "string"
},
"severity": {
"title": "Severity",
"type": "string"
},
"assignedTo": {
"title": "Assigned To",
"type": "string",
"format": "url"
},
"urgency": {
"title": "Urgency",
"type": "string"
},
"contactType": {
"title": "Contact Type",
"type": "string"
},
"createdOn": {
"title": "Created On",
"type": "string",
"format": "date-time"
},
"createdBy": {
"title": "Created By",
"type": "string"
},
"isActive": {
"title": "Is Active",
"type": "boolean"
},
"priority": {
"title": "Priority",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {}
}
Integration configuration
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: incident
selector:
query: "true"
port:
entity:
mappings:
identifier: .number | tostring
title: .short_description
blueprint: '"servicenowIncident"'
properties:
category: .category
reopenCount: .reopen_count
severity: .severity
assignedTo: .assigned_to.link
urgency: .urgency
contactType: .contact_type
createdOn: '.sys_created_on | (strptime("%Y-%m-%d %H:%M:%S") | strftime("%Y-%m-%dT%H:%M:%SZ"))'
createdBy: .sys_created_by
isActive: .active
priority: .priority
Let's Test It
This section includes a sample response data from ServiceNow. In addition, it includes the entity created from the resync event based on the Ocean configuration provided in the previous section.
Payload
Here is an example of the payload structure from ServiceNow:
Group response data
{
"parent": "",
"manager": "",
"roles": "",
"sys_mod_count": "0",
"active": "true",
"description": "\n\t\tGroup for all people who have the Analytics Admin role\n\t",
"source": "",
"sys_updated_on": "2020-03-17 11:39:14",
"sys_tags": "",
"type": "",
"sys_id": "019ad92ec7230010393d265c95c260dd",
"sys_updated_by": "admin",
"cost_center": "",
"default_assignee": "",
"sys_created_on": "2020-03-17 11:39:14",
"name": "Analytics Settings Managers",
"exclude_manager": "false",
"email": "",
"include_members": "false",
"sys_created_by": "admin"
}
Service Catalog response data
{
"manager": {
"link": "https://dev229583.service-now.com/api/now/table/sys_user/6816f79cc0a8016401c5a33be04be441",
"value": "6816f79cc0a8016401c5a33be04be441"
},
"sys_mod_count": "0",
"active": "true",
"description": "Description for service catalog",
"desktop_continue_shopping": "",
"enable_wish_list": "false",
"sys_updated_on": "2023-12-14 15:30:54",
"sys_tags": "",
"title": "Test Service Catalog",
"sys_class_name": "sc_catalog",
"desktop_image": "",
"sys_id": "56e48e6a9743311083e6ff0de053af56",
"sys_package": {
"link": "https://dev229583.service-now.com/api/now/table/sys_package/global",
"value": "global"
},
"desktop_home_page": "",
"sys_update_name": "sc_catalog_56e48e6a9743311083e6ff0de053af56",
"sys_updated_by": "admin",
"sys_created_on": "2023-12-14 15:30:54",
"sys_name": "Test Service Catalog",
"sys_scope": {
"link": "https://dev229583.service-now.com/api/now/table/sys_scope/global",
"value": "global"
},
"editors": "",
"sys_created_by": "admin",
"sys_policy": ""
}
Incident response data
{
"parent": "",
"made_sla": "true",
"caused_by": "",
"watch_list": "",
"upon_reject": "cancel",
"sys_updated_on": "2016-12-14 02:46:44",
"child_incidents": "0",
"hold_reason": "",
"origin_table": "",
"task_effective_number": "INC0000060",
"approval_history": "",
"number": "INC0000060",
"resolved_by": {
"link": "https://dev229583.service-now.com/api/now/v1/table/sys_user/5137153cc611227c000bbd1bd8cd2007",
"value": "5137153cc611227c000bbd1bd8cd2007"
},
"sys_updated_by": "employee",
"opened_by": {
"link": "https://dev229583.service-now.com/api/now/v1/table/sys_user/681ccaf9c0a8016400b98a06818d57c7",
"value": "681ccaf9c0a8016400b98a06818d57c7"
},
"user_input": "",
"sys_created_on": "2016-12-12 15:19:57",
"sys_domain": {
"link": "https://dev229583.service-now.com/api/now/v1/table/sys_user_group/global",
"value": "global"
},
"state": "7",
"route_reason": "",
"sys_created_by": "employee",
"knowledge": "false",
"order": "",
"calendar_stc": "102197",
"closed_at": "2016-12-14 02:46:44",
"cmdb_ci": {
"link": "https://dev229583.service-now.com/api/now/v1/table/cmdb_ci/109562a3c611227500a7b7ff98cc0dc7",
"value": "109562a3c611227500a7b7ff98cc0dc7"
},
"delivery_plan": "",
"contract": "",
"impact": "2",
"active": "false",
"work_notes_list": "",
"business_service": {
"link": "https://dev229583.service-now.com/api/now/v1/table/cmdb_ci_service/27d32778c0a8000b00db970eeaa60f16",
"value": "27d32778c0a8000b00db970eeaa60f16"
},
"business_impact": "",
"priority": "3",
"sys_domain_path": "/",
"rfc": "",
"time_worked": "",
"expected_start": "",
"opened_at": "2016-12-12 15:19:57",
"business_duration": "1970-01-01 08:00:00",
"group_list": "",
"work_end": "",
"caller_id": {
"link": "https://dev229583.service-now.com/api/now/v1/table/sys_user/681ccaf9c0a8016400b98a06818d57c7",
"value": "681ccaf9c0a8016400b98a06818d57c7"
},
"reopened_time": "",
"resolved_at": "2016-12-13 21:43:14",
"approval_set": "",
"subcategory": "email",
"work_notes": "",
"universal_request": "",
"short_description": "Unable to connect to email",
"close_code": "Solved (Permanently)",
"correlation_display": "",
"delivery_task": "",
"work_start": "",
"assignment_group": {
"link": "https://dev229583.service-now.com/api/now/v1/table/sys_user_group/287ebd7da9fe198100f92cc8d1d2154e",
"value": "287ebd7da9fe198100f92cc8d1d2154e"
},
"additional_assignee_list": "",
"business_stc": "28800",
"cause": "",
"description": "I am unable to connect to the email server. It appears to be down.",
"origin_id": "",
"calendar_duration": "1970-01-02 04:23:17",
"close_notes": "This incident is resolved.",
"notify": "1",
"service_offering": "",
"sys_class_name": "incident",
"closed_by": {
"link": "https://dev229583.service-now.com/api/now/v1/table/sys_user/681ccaf9c0a8016400b98a06818d57c7",
"value": "681ccaf9c0a8016400b98a06818d57c7"
},
"follow_up": "",
"parent_incident": "",
"sys_id": "1c741bd70b2322007518478d83673af3",
"contact_type": "self-service",
"reopened_by": "",
"incident_state": "7",
"urgency": "2",
"problem_id": "",
"company": {
"link": "https://dev229583.service-now.com/api/now/v1/table/core_company/31bea3d53790200044e0bfc8bcbe5dec",
"value": "31bea3d53790200044e0bfc8bcbe5dec"
},
"reassignment_count": "2",
"activity_due": "2016-12-13 01:26:36",
"assigned_to": {
"link": "https://dev229583.service-now.com/api/now/v1/table/sys_user/5137153cc611227c000bbd1bd8cd2007",
"value": "5137153cc611227c000bbd1bd8cd2007"
},
"severity": "3",
"comments": "",
"approval": "not requested",
"sla_due": "",
"comments_and_work_notes": "",
"due_date": "",
"sys_mod_count": "15",
"reopen_count": "0",
"sys_tags": "",
"escalation": "0",
"upon_approval": "proceed",
"correlation_id": "",
"location": "",
"category": "inquiry"
}
Mapping Result
The combination of the sample payload and the Ocean configuration generates the following Port entity:
Group entity in Port
{
"identifier": "019ad92ec7230010393d265c95c260dd",
"title": "Analytics Settings Managers",
"icon": null,
"blueprint": "servicenowGroup",
"team": [],
"properties": {
"description": "\n\t\tGroup for all people who have the Analytics Admin role\n\t",
"isActive": true,
"createdOn": "2020-03-17T11:39:14Z",
"createdBy": "admin"
},
"relations": {},
"createdAt": "2023-12-18T08:37:21.637Z",
"createdBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW",
"updatedAt": "2023-12-18T08:37:21.637Z",
"updatedBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW"
}
Service catalog entity in Port
{
"identifier": "56e48e6a9743311083e6ff0de053af56",
"title": "Test Service Catalog",
"icon": null,
"blueprint": "servicenowCatalog",
"team": [],
"properties": {
"description": "Description for service catalog",
"isActive": true,
"createdOn": "2023-12-14T15:30:54Z",
"createdBy": "admin"
},
"relations": {},
"createdAt": "2023-12-18T08:37:28.087Z",
"createdBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW",
"updatedAt": "2023-12-18T08:37:28.087Z",
"updatedBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW"
}
Incident entity in Port
{
"identifier": "INC0000060",
"title": "Unable to connect to email",
"icon": null,
"blueprint": "servicenowIncident",
"team": [],
"properties": {
"category": "inquiry",
"reopenCount": "0",
"severity": "3",
"assignedTo": "https://dev229583.service-now.com/api/now/table/sys_user/5137153cc611227c000bbd1bd8cd2007",
"urgency": "2",
"contactType": "self-service",
"createdOn": "2016-12-12T15:19:57Z",
"createdBy": "employee",
"isActive": false,
"priority": "3"
},
"relations": {},
"createdAt": "2023-12-15T14:52:06.347Z",
"createdBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW",
"updatedAt": "2023-12-15T15:34:18.248Z",
"updatedBy": "hBx3VFZjqgLPEoQLp7POx5XaoB0cgsxW"
}
Relevant Guides
For relevant guides and examples, see the guides section.
Alternative installation via webhook
While the Ocean integration described above is the recommended installation method, you may prefer to use a webhook to ingest data from ServiceNow. If so, use the following instructions:
Note that when using the webhook installation method, data will be ingested into Port only when the webhook is triggered.
Webhook installation (click to expand)
In this example you are going to create a webhook integration between ServiceNow and Port, which will ingest ServiceNow change requests into Port. This integration will involve setting up a webhook to receive notifications from Servicenow whenever a change request is created or updated.
Import ServiceNow change request
Port configuration
Create the blueprint definition:
Servicenow change request blueprint
{
"identifier": "servicenowChangeRequest",
"title": "Servicenow Change Request",
"icon": "Servicenow",
"schema": {
"properties": {
"number": {
"title": "Change Number",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"priority": {
"title": "Priority",
"type": "string"
},
"state": {
"icon": "DefaultProperty",
"title": "State",
"type": "string"
},
"createdOn": {
"title": "Created On",
"type": "string",
"format": "date-time"
},
"createdBy": {
"title": "Created By",
"type": "string"
},
"category": {
"type": "string",
"title": "Category"
},
"approval": {
"title": "Approval",
"icon": "DefaultProperty",
"type": "string",
"enum": [
"approved",
"not requested",
"requested",
"rejected"
],
"enumColors": {
"approved": "green",
"not requested": "turquoise",
"requested": "yellow",
"rejected": "pink"
}
},
"tags": {
"type": "string",
"title": "Tags"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {}
}
Create the following webhook configuration using Port UI
Servicenow webhook configuration
-
Basic details tab - fill the following details:
- Title :
Servicenow Mapper
; - Identifier :
servicenow_mapper
; - Description :
A webhook configuration to map Servicenow change requests to Port
; - Icon :
Servicenow
;
- Title :
-
Integration configuration tab - fill the following JQ mapping:
[
{
"blueprint": "servicenowChangeRequest",
"operation": "create",
"filter": "true",
"entity": {
"identifier": ".body.sys_id | tostring",
"title": ".body.short_description | tostring",
"properties": {
"number": ".body.number",
"state": ".body.phase_state",
"approval": ".body.approval",
"category": ".body.category",
"priority": ".body.priority",
"description": ".body.description",
"service": ".body.business_service",
"tags": ".body.tags",
"createdOn": ".body.sys_updated_on",
"createdBy": ".body.opened_by"
}
}
}
] -
Scroll down to Advanced settings, leave the form blank and click Save at the bottom of the page
Create a webhook in ServiceNow
- Log in to your ServiceNow instance
- Go to System Definition > Business Rules.
- Click New to create a business rule:
- Name:
Change Request Webhook
- Table:
Change Request [change_request]
- Is Active, Advanced: Check both
- Name:
- In the When to run tab, provide the following details:
- Insert, Update: Check both
- When:
Async
- Order: leave the default value of
100
- In the Advanced tab, add the following script:
ServiceNow configuration code (click to expand)
(function executeRule(current, previous /*null when async*/) {
gs.info('Triggering outbound REST API call for Change Request ID: ' + current.number);
if (current == null){
gs.error('Current record is null. Exiting the Business Rule.');
return;
}
// Prepare the REST message
var restMessage = new sn_ws.RESTMessageV2();
restMessage.setHttpMethod('POST');
restMessage.setEndpoint('https://ingest.getport.io/<WEBHOOK_KEY>');
restMessage.setRequestHeader('Content-Type', 'application/json');
// Construct the payload with additional fields
var payload = {
"sys_id": current.sys_id.toString(),
"number": current.number.toString(),
"state": current.state.toString(),
"short_description": current.short_description.toString(),
"description": current.description.toString(),
"sys_updated_by": current.sys_updated_by.toString(),
"sys_updated_on": current.sys_updated_on.toString(),
"approval": current.approval.toString(),
"priority": current.priority ? current.priority.toString() : '',
"phase": current.phase ? current.phase.toString() : '',
"business_service": current.business_service ? current.business_service.toString() : '',
"phase_state": current.phase_state ? current.phase_state.toString() : '',
"category": current.category ? current.category.toString() : '',
"tags": current.u_external_tag ? current.sys_tags.toString() : '',
"impact": current.impact ? current.impact.toString() : '',
"urgency": current.urgency ? current.urgency.toString() : '',
"risk": current.risk ? current.risk.toString() : '',
"assignment_group": current.assignment_group ? current.assignment_group.toString() : '',
"opened_by": current.opened_by ? current.opened_by.toString() : '',
"sys_domain": current.sys_domain ? current.sys_domain.toString() : ''
};
// Set the request body with the payload
restMessage.setRequestBody(JSON.stringify(payload));
// Execute the outbound REST call
try {
var response = restMessage.execute(); // Use async to avoid blocking
gs.info('Business Rule executed for Change Request: ' + current.number.toString());
gs.info('Response Status Code: ' + response.getStatusCode());
gs.info('Response Body: ' + response.getBody());
} catch (error) {
gs.error('Error in outbound REST call: ' + error.message);
}
})(current, previous);
- Save and activate the Business Rule.
Done! any change that happens to your change requests in ServiceNow will trigger a webhook event to the webhook URL provided by Port. Port will parse the events according to the mapping and update the catalog entities accordingly.
Let's Test It
This section includes a sample webhook event sent from ServiceNow when a change request is created or updated. In addition, it includes the entity created from the event based on the webhook configuration provided in the previous section.
Payload
Here is an example of the payload structure sent to the webhook URL when a ServiceNow change request is created or updated:
Webhook event payload
{
"body": {
"sys_id": "8a76536683f5de104665c730ceaad3bd",
"number": "CHG0030040",
"state": "3",
"short_description": "Automated change request from GitLab CI/CD",
"description": "needs approval",
"sys_updated_by": "admin",
"sys_updated_on": "2024-11-14 10:57:08",
"approval": "approved",
"priority": "2",
"phase": "requested",
"business_service": "getport-labs/awesome-projec",
"phase_state": "open",
"category": "Network",
"tags": "r_QWB886MmmkIBRGD5",
"impact": "3",
"urgency": "3",
"risk": "3",
"assignment_group": "287ebd7da9fe198100f92cc8d1d2154e",
"opened_by": "6816f79cc0a8016401c5a33be04be441",
"sys_domain": "global"
},
"queryParams": {}
}
Mapping Result
The combination of the sample payload and the webhook configuration generates the following Port entity:
{
"identifier": "8a76536683f5de104665c730ceaad3bd",
"title": "Automated change request from GitLab CI/CD",
"blueprint": "servicenowChangeRequest",
"properties": {
"number": "CHG0030040",
"state": "open",
"approval": "approved",
"category": "Network",
"priority": "2",
"description": "needs approval",
"service": "getport-labs/awesome-projec",
"tags": "r_QWB886MmmkIBRGD5",
"createdOn": "2024-11-14 10:57:08",
"createdBy": "6816f79cc0a8016401c5a33be04be441"
},
"relations": {},
"filter": true
}