Skip to content

Instantly share code, notes, and snippets.

@jmaxwell81
jmaxwell81 / CSDashboard.html
Created June 20, 2018 19:11 — forked from afaulkinberry/CSDashboard.html
ServiceNow UI Page using AngularJS
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:requires name="angular-min.1.3.16.jsdbx" />
<link href="3ca86ab937380a006215d68543990ef6.cssdbx" rel="stylesheet" type="text/css"></link>
<g2:evaluate var="jvar_stamp">
var gr = new GlideRecord('sys_ui_script');
gr.get("13a5ea4d37300a006215d68543990e41");
gr.getValue('sys_updated_on');
</g2:evaluate>
<g:requires name="cs-dashboard-script.jsdbx" params="cache=$[jvar_stamp]" />
@jmaxwell81
jmaxwell81 / ServiceNow_test1.py
Created January 20, 2019 05:24 — forked from enriquemanuel/ServiceNow_test1.py
Testing Service Now to do some sort of integration
from servicenow import ServiceNow
from servicenow import Connection
url = 'https://blackboardmhtest.service-now.com/nav_to.do?uri=change_request.do?sys_id=6de713116f937500cec1bebf2c3ee497%26sysparm_view=ess'
instance = 'blackboardmhtest'
user = 'username'
pwd = 'XXXX'
conn = Connection.Auth(username=user, password=pwd, instance=instance)
@jmaxwell81
jmaxwell81 / servicenow_rest_attachment_api_python_mulitpart_example.py
Created January 20, 2019 05:27 — forked from bryanbarnard/servicenow_rest_attachment_api_python_mulitpart_example.py
ServiceNow REST Attachment API Example Python Example using /now/attachment/upload endpoint to post (upload) a file as an attachment to an incident as multipart form data.
# This example uses the Python Requests Library and you will need to install requests package for python
# Documentation can be found at http://docs.python-requests.org/en/master/user/quickstart/
import requests
import pprint
import json
# Specify the Endpoint URL replacing {servicenow_instance_name} with your ServiceNow Instance Name
url = 'https://{servicenow_instance_name}.service-now.com/api/now/attachment/upload'
@jmaxwell81
jmaxwell81 / sn_export_update_sets_to_midserver.md
Created January 20, 2019 05:27 — forked from harrisitservices/sn_export_update_sets_to_midserver.md
ServiceNow: Exporting Update Sets to the Midserver

ServiceNow: Exporting Update Sets to the MidServer

This gist includes a script include and background script that can be used to export files from ServiceNow to a connected Midserver in many different formats. I took the code provided here and tweaked it so that I could do what I wanted to do.

Components

  • MidServer Script Include
var ExportToMidserver = Class.create();
@jmaxwell81
jmaxwell81 / servicenow.js
Created January 20, 2019 05:29 — forked from danderson00/servicenow.js
ServiceNow Authentication
const fetch = require('node-fetch')
const querystring = require('querystring')
var data = querystring.stringify({
"grant_type": "password",
// client_id and client_secret are from the System OAuth -> Application Registrations screen on the ServiceNow portal
"client_id": "",
"client_secret": "",
// username and password are valid user credentials for a user in the ServiceNow instance
"username": "",
@jmaxwell81
jmaxwell81 / export.pl
Created January 20, 2019 05:32 — forked from arbonboy/export.pl
A Perl script that will export all of the data from a table in ServiceNow
#!/usr/bin/perl
#Required Libraries
use strict;
use warnings;
use utf8;
use LWP::UserAgent;
use HTTP::Request::Common qw(GET);
use XML::XPath;
@jmaxwell81
jmaxwell81 / getApisForScript.js
Created January 20, 2019 05:34 — forked from johncaruso/getApisForScript.js
Get ServiceNow APIs for Script Editor
/**
* Get ServiceNow APIs for Script Editor
*
* Returns context-specific API for use within Script Editor
*
* @param {GlideRecord} gr - GlideRecord containing script being edited
* @param {*} field - script field name
* @returns {Object} - parsed JSON API
*/
function getApisForScript(gr, field) {
@jmaxwell81
jmaxwell81 / fixTrackInUpdateSets.js
Created January 20, 2019 05:35 — forked from johncaruso/fixTrackInUpdateSets.js
Fixes issues when using "Track in Update Sets" UI action on custom scoped app table.
/**
* Fixes issues when using "Track in Update Sets" UI action on custom scoped app table.
*
* Per https://community.servicenow.com/community?id=community_question&sys_id=760fb629db58dbc01dcaf3231f9619bd
* a temporary table with a prefix of rep$x_ may be added to your app scope.
*
* As of Kingston, table columns get created in app scope but the table does not.
*
* @param {string} tableName
*/
/*
Given:
AD Groups: group(members)
|
|_a(1)
| |_b(2,3)
| | |_c(4)
| |_d(2,5)
@jmaxwell81
jmaxwell81 / AttachmentImportProcessor.js
Created January 20, 2019 05:38 — forked from johncaruso/AttachmentImportProcessor.js
Service Now Email Attachment Processor.Allows ServiceNow to accept attachments via email and process them through a data source/import set/ transform map.
/*
* Script include to process multiple attachments in an email through OOB Data Source process.
* Attaches to existing data source, dynamically creates a schedule import entry and runs.
* Processes attachments synchronously to prevent issues with multiple attachments
*
* Source: Fruition Partners
* Author: Chris.Nanda@fruitionpartners.com
* Author: Paul.Senatillaka@fruitionpartners.com
*/