Skip to content

Instantly share code, notes, and snippets.

@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;
@eduglez
eduglez / SNAutoDoc5.js
Created May 30, 2019 13:34
ServiceNow - Generate documentation in Markdown directly from the browser console
(function(){
var text = "";
var printl = function(str){
text = text + str + '\n';
};
var println = function(str) {
if(str){
text = text + str + '\n\n';
@eduglez
eduglez / SNDuplicateTransformMap.js
Created May 31, 2019 12:55
ServiceNow - Duplicate Transform Maps
(function(sourceMapSysId, targetMapSysId, targetTableName){
var grNewMap = new GlideRecord('sys_transform_map');
if(!grNewMap.get(targetMapSysId)){
return;
}
var grOriginalMap = new GlideRecord('sys_transform_map');
if(!grOriginalMap.get(sourceMapSysId)){
@eduglez
eduglez / SNGetObjectProperties.js
Created January 21, 2020 17:59
Gets ServiceNow server object properties
var category2 = new GlideHTTPResponse();
gs.print(typeof GlideHTTPResponse);
gs.print(typeof category2);
var output = '';
var property;
for (property in category2) {
try{
output += property + ': ' + category2[property]+'; \n';