Skip to content

Instantly share code, notes, and snippets.

@ToneyTime
ToneyTime / CloudBoltAPI-ClientScript
Created April 20, 2018 15:37
Grabbing and Parsing JSON response via AJAX in Client Side code for Catalog
function onLoad() {
var ga = new GlideAjax('CloudBoltAPI');
ga.addParam("sysparm_name","getGroupListJSON");
ga.getXML(ajaxResponse);
function ajaxResponse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer) {
var jsonData = JSON.parse(answer);
for (var i = 0; i < jsonData._embedded.length; i++) {
@ToneyTime
ToneyTime / CloudBoltAPI-ScriptInclude
Created April 20, 2018 15:26
Simplifies chaining 2 APIs, Auth + Function, into single Script Include Call
var CloudBoltAPI = Class.create();
CloudBoltAPI.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGroupListJSON: function() {
var tokenJSON = this._getAuthToken();
var tokenParsed = JSON.parse(tokenJSON);
var token = tokenParsed.token;
try {
@ToneyTime
ToneyTime / getMySubscribedServices.txt
Created October 22, 2017 14:05
getMySubscribedServices Script Include
function getMySubscribedServices(){
var arrSvc = [];
gr = new GlideRecord('sys_notif_subscription');
gr.addQuery('user',gs.getUserID());
//gr.addQuery('affected_table','cmdb_ci');
gr.query();
while (gr.next()) {
arrSvc.push(gr.affected_record.toString());
@ToneyTime
ToneyTime / Eurobody.html
Created October 17, 2017 12:42
Example of good Body from EURO
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
caller: HR EURO Caller<br>
caller_location:KBPUK<br>
contact_name:LPOC NameHere<br>
contact_number: 00000 000 000<br>
contact_email:LPOCEmailHere@IHG.com<br>
@ToneyTime
ToneyTime / EuroHeaders
Created October 17, 2017 12:42
Example of EURO email headers
Return-Path:<GSSRequestFulfillmentNoReply@ihg.com>
Delivered-To:<ihg@ihg.service-now.com>
Received:from mda01.iad0.service-now.com
by mda01.iad0.service-now.com (Dovecot) with LMTP id W+0pJKCJ3FkpDQAAVjKaqw
for <ihg@ihg.service-now.com>; Tue, 10 Oct 2017 01:51:14 -0700
Received:from mta01.ytz0.service-now.com (unknown [10.248.8.166])
by mda01.iad0.service-now.com (Postfix) with ESMTPS id 26969201C045
for <ihg@ihg.service-now.com>; Tue, 10 Oct 2017 01:51:14 -0700 (PDT)
Received:from localhost (localhost [127.0.0.1])
by mta01.ytz0.service-now.com (Postfix) with ESMTP id E10FCCBE0D9
@ToneyTime
ToneyTime / ToneyTestheaders
Created October 17, 2017 12:32
These Headers are part of email working fine
Return-Path:<toney.vecchio@ihg.com>
Delivered-To:<ihguat@ihguat.service-now.com>
Received:from mda01.iad0.service-now.com
by mda01.iad0.service-now.com (Dovecot) with LMTP id pU5pNKn35VlYvAAAVjKaqw
for <ihguat@ihguat.service-now.com>; Tue, 17 Oct 2017 05:29:30 -0700
Received:from mta03.sjc0.service-now.com (unknown [10.248.8.166])
by mda01.iad0.service-now.com (Postfix) with ESMTPS id 70BF5201C005
for <ihguat@ihguat.service-now.com>; Tue, 17 Oct 2017 05:29:30 -0700 (PDT)
Received:from localhost (localhost [127.0.0.1])
by mta03.sjc0.service-now.com (Postfix) with ESMTP id BD757732062
@ToneyTime
ToneyTime / HeadersNotWorking
Created October 17, 2017 12:30
These headers are part of the AMEA Email not working
Return-Path:<no-reply@ihg.com>
Delivered-To:<ihguat@ihguat.service-now.com>
Received:from mda01.iad0.service-now.com
by mda01.iad0.service-now.com (Dovecot) with LMTP id w+iXIPPD4FmJdgAAVjKaqw
for <ihguat@ihguat.service-now.com>; Fri, 13 Oct 2017 06:47:59 -0700
Received:from mta01.sjc0.service-now.com (unknown [10.248.8.166])
by mda01.iad0.service-now.com (Postfix) with ESMTPS id 436F4201C04F
for <ihguat@ihguat.service-now.com>; Fri, 13 Oct 2017 06:47:59 -0700 (PDT)
Received:from localhost (localhost [127.0.0.1])
by mta01.sjc0.service-now.com (Postfix) with ESMTP id 99C45B040B3
@ToneyTime
ToneyTime / BodyNotWorking.html
Created October 17, 2017 12:26
This body is not working from AMEA Solarwinds
caller:caller_not_found<br/>caller_location:APSDO<br/>category:Networking & Connectivity<br/>business_service:WAN<br/>situation:MPLS link<br/>impact:3<br/>urgency:2<br/>short_description:SYDCB - CP Coogee Beach Sydney – 10.151.13.1 – Monitor Alert<br/>description_start:<br/>AMEA GT Network Monitoring Status Alert<br/>Hotel: SYDCB - CP Coogee Beach Sydney<br/>Network Monitoring Status: Down <br/>Device IP: 10.151.13.1<br/>Country: AU<br/>Date & Time Stamp: 10/13/2017 9:47 PM<br/>description_end:<br/>source:Solarwinds AMEA
@ToneyTime
ToneyTime / ToneyTestBody.html
Last active October 17, 2017 12:31
This HTML Body is working fine
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div>caller:caller_not_found</div>
@ToneyTime
ToneyTime / Sample.json
Last active October 15, 2017 18:51
Sample of JSON Code
{
"sourceA":{
"employeeNum":"123",
"firstName":"Bob",
"profile":{
"jobTitle":"Head Honcho",
"businessTitle":"Senior Manager"
},
"location":"US430"
},