Skip to content

Instantly share code, notes, and snippets.

View nancystodd's full-sized avatar

Nancy S Todd nancystodd

View GitHub Profile
@nancystodd
nancystodd / 0_reuse_code.js
Created March 7, 2016 00:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@nancystodd
nancystodd / countries.json
Created June 16, 2016 19:18 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@nancystodd
nancystodd / Random Number Jquery
Created October 11, 2017 22:03 — forked from Mikescops/Random Number Jquery
Generate a random number into html with jQuery process.
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<p><a href="no-javascript.html" id="getNumber">Générer</a> un nombre aléatoire. </p>
@nancystodd
nancystodd / background.script.js
Created February 6, 2018 18:39 — forked from mozrat/background.script.js
ServiceNow PDF Generation
var UP3PDF = Class.create();
UP3PDF.prototype = Object.extendsObject(AbstractAjaxProcessor, {
_document : null,
createPDF : function(html, table, sys_id, filename) {
var pdfDoc = new GeneralPDF.Document(null, null, null, null, null, null);
this._document = new GeneralPDF(pdfDoc);
this._document.startHTMLParser();
this._document.addHTML(html);
@nancystodd
nancystodd / servicenow_datatables.js
Created February 6, 2018 18:43 — forked from dmfranko/servicenow_datatables.js
ServiceNow and datatables
<?xml version="1.0" encoding="UTF-8"?>
<j:jelly xmlns:j="jelly:core" xmlns:g="glide" xmlns:g2="null" xmlns:j2="null" trim="false">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js" />
<!-- Don't include bootstrap or jquery-->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/r/bs/pdfmake-0.1.18,dt-1.10.9,b-1.0.3,b-html5-1.0.3,b-print-1.0.3,r-1.0.7,sc-1.3.0/datatables.min.css" />
<script type="text/javascript" src="https://cdn.datatables.net/r/bs/pdfmake-0.1.18,dt-1.10.9,b-1.0.3,b-html5-1.0.3,b-print-1.0.3,r-1.0.7,sc-1.3.0/datatables.min.js" />
<div class="container" id="container" ng-app="myApp">
<h4>My Incidents</h4>
<table class="table display nowrap" id="incidents" ng-controller="IncidentController" cellspacing="0" width="100%">
@nancystodd
nancystodd / Global Script Search.js
Created February 6, 2018 18:47 — forked from thornem3/Global Script Search.js
ServiceNow code snippits
//Stick this in a background script and use to search scripts anywhere in the system.
var term = "search,terms"; //use comma to separate terms
var useAndQuery = true; //search for term 1 and term 2. If false, it will look for term 1 or term 2.
var debug = false; //set this true if you want to troubleshoot the script.
var delimiter = ","; //if you want to split terms on something other than a comma
var globalScriptSearch = {
search: null,
@nancystodd
nancystodd / CSDashboard.html
Created February 6, 2018 18:55 — 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]" />
@nancystodd
nancystodd / sn_search_field_for_duplicate_values.md
Created February 6, 2018 18:57 — forked from harrisitservices/sn_search_field_for_duplicate_values.md
ServiceNow - Search Field for Duplicate Values

Search Field for Duplicate Values

This script uses GlideAggregate to search a field on a table for duplicate values. It then returns the value with duplicates in an array.

var xx = new GlideAggregate('table');  
xx.addAggregate('COUNT', 'field');  
xx.addHaving('COUNT', 'field', '>', '1');  
xx.query();  
var answer = []; 
@nancystodd
nancystodd / getXMLNodes.js
Last active June 26, 2018 21:44
Get nodes from XMLDocument - SN example
var response = s.post();
var xmldoc = new XMLDocument(response, true);
var nodelist = xmldoc.getNodes("//Action/*");
for(var i=0;i<nodelist.getLength();i++){
gs.print(nodelist.item(i).getNodeName() +' : '+nodelist.item(i).getLastChild().getNodeValue()+'\n');
@nancystodd
nancystodd / README-Template.md
Created April 25, 2018 15:39 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites