Helper script include for dealing with variables in servicenow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var emailScriptHelper = Class.create(); | |
emailScriptHelper.prototype = { | |
initialize: function() {}, | |
varsToHTMLTable: function(variables) { | |
if (variables == 'undefined') { | |
return; | |
} | |
var helperOptions = {'useLable': true,'useDisplayValue': true}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| |
function validateQuery(grToCheck) { | |
return grToCheck.isEncodedQueryValid(grToCheck.getEncodedQuery()); | |
} | |
function isNullOrEmpty(val) { | |
return val == null || val == '' || val == undefined; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validateQuery(grToCheck) { | |
return grToCheck.isEncodedQueryValid(grToCheck.getEncodedQuery()); | |
} | |
function isNullOrEmpty(val) { | |
return val == null || val == '' || val == undefined; | |
} | |
function validateArgs() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SecretServer = Class.create(); | |
SecretServer.prototype = { | |
initialize: function() { | |
this.BASE_URL = 'https://mySecretServer/SecretServer'; //temp change due to load balanced URL being down | |
this.AUTH_PROFILE = 'SYSID'; //sys_id of basic auth profile | |
this.TOKEN_CRED = this._getCredential(this.AUTH_PROFILE); //Glide Record of auth Profile | |
this.ACCESS_TOKEN = ''; //Holder for Access Token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var recordToHTML = (function() { | |
//class variables | |
var exclusions = { | |
"sections": [], | |
"fields": [] | |
}; | |
/******************************** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getCartItem = function (sys_id) { | |
var gr = new GlideRecord("sc_cart_item"); | |
gr.get(sys_id); | |
return gr; | |
}; | |
var addAttToCartItems = function (items,cat_item) { | |
var attachment = new GlideSysAttachment(); | |
//set up inputs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
function newGrObject(tbl, obj) { | |
var grRec = new GlideRecord(tbl); | |
new GlideRecordUtil().mergeToGR(obj, grRec); | |
grRec.insert(); | |
} | |
var oldUiPolicy = 'f6e44e7bdbc005101ad90cd7f4961916'; | |
var newUiPolicy = '05610f08db50c5101ad90cd7f4961937'; | |
var tbl = 'catalog_ui_policy_action'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Dot walk object until last property reached | |
* @param {Object} obj obj | |
* @param {Array} props array of object properties | |
* @returns the last object value | |
*/ | |
function recurseObjChildren(obj, props) { | |
props = Array.isArray(props) ? props : props.split('.'); | |
var item = props.shift(); | |
var arrLen = props.length; |
OlderNewer