Skip to content

Instantly share code, notes, and snippets.

View nancystodd's full-sized avatar

Nancy S Todd nancystodd

View GitHub Profile
(function() {
var comment = "Workflow cancelled by " + gs.getUserDisplayName();
new WorkflowApprovalUtils().cancelAll(current, comment);
new Workflow().restartWorkflow(current);
current.work_notes = comment;
//cancel current flow context and start new
if (!current.cat_item.flow_designer_flow.nil() && !current.flow_context.nil()) {
@ChecksumFailed
ChecksumFailed / DataTransformRecord.js
Last active May 1, 2024 20:21
ServiceNow Data Tranformation helper script
/**
* DataTransformRecord Class
* Manages the lifecycle of data transformation in ServiceNow by automating the creation, manipulation,
* and cleanup of data sources and associated transform maps.
*
* @class
*/
var DataTransformRecord = function() {
var datasource;
var map;
@ChecksumFailed
ChecksumFailed / ServiceNow_ExcelToObject.js
Last active June 12, 2023 18:07
ServiceNow: Convert Excel attachment to an object
function excelToObject(attID) {
if (!attID || !isValidSysId(attID)) {
throw new Error("Valid attachment id required");
}
var excelObj = [];
var attachment = new GlideSysAttachment();
var attachmentStream = attachment.getContentStream(attID);
@bgoonz
bgoonz / free-4-dev.md.md
Created April 26, 2021 04:53
free-resources

free-for.dev

Developers and Open Source authors now have a massive amount of services offering free tiers, but it can be hard to find them all to make informed decisions.

This is a list of software (SaaS, PaaS, IaaS, etc.) and other offerings that have free tiers for developers.

The scope of this particular list is limited to things that infrastructure developers (System Administrator, DevOps Practitioners, etc.) are likely to find useful. We love all the free services out there, but it would be good to keep it on topic. It's a bit of a grey line at times so this is a bit opinionated; do not be offended if I do not accept your contribution.

This list is the result of Pull Requests, reviews, ideas and work done by 900+ people. You too can help by sending Pull Requests to add more services or by remove ones whose offerings have changed or been retired.

ServiceNow - Jelly scripting cheatsheet

UI Page consists of jelly, client script and processing script. UI Macro has the jelly script only (but client script can be injected in jelly script) Usages:

  • Open as a page using URI https://<instance_name>.service-now/<ui_page_name>.do
  • Open as a modal using client script (UI action, client script, etc) (see snippet 1)
// Snippet 1
var gm = new GlideModal('UI_dialog_name');
gm.setTitle('Show title');
@nancystodd
nancystodd / snkeepalive.sh
Last active March 18, 2020 21:36 — forked from assertivist/snkeepalive.sh
keeps a ServiceNow developer instance awake, at least until the nightly snooze-all
#!/bin/bash
# put your instance id here
instance="dev######"
# make sure your password doesn't have shell operators in it
credentials="admin:password"
while true; do
entropy==$RANDOM
outdata="{\"short_description\":\"Automated incident $entropy\"}"
@nabil-nuvolo
nabil-nuvolo / createDataSource.js
Last active January 18, 2022 18:09
A series of methods that can be strung together to automate data import through Import Sets
// @param att {GlideRecord - sys_attachment}
function createDataSource(att) {
// Create new data source
var ds = new GlideRecord("sys_data_source");
ds.initialize();
ds.setValue("name", att.getValue("file_name"));
ds.setValue("import_set_table_name", "x_nuvo_eam_pi_device_import");
ds.setValue("type", "File");
ds.setValue("format", "CSV");
ds.setValue("file_retrieval_method", "Attachment");
@iamwill
iamwill / gliderecord_cheatsheet.md
Last active July 14, 2024 09:44
GlideRecord cheatsheet

GlideRecord & GlideAggregate Cheat Sheet ❗

GlideRecord(String tableName) ❗

var gr = new GlideRecord('incident'); // use the incident table
gr.query(); // fetch data from the database
while (gr.next()) { // advance
    gs.info(gr.short_description);
}
@eduglez
eduglez / SNSVDataGenerator.js
Last active October 24, 2019 00:32
ServiceNow - Generate CSV Test File from Real Data retrieved from a REST call
// To be used directly from the console
// CSV fields
var FIELDS = "field_1,field_2,field_3".split(",");
var counter = 0;
// Dynamic creation of data for the fields defined here
var GENERATED_FIELDS = {
field_1: function(){
counter = counter + 1;
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active November 17, 2024 20:40
Conventional Commits Cheatsheet

Conventional Commit Messages starline

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions, determine version and generate changelogs

Commit Message Formats

Default