Last active
March 22, 2024 15:34
-
-
Save ChecksumFailed/13f88aaaadf218c36c13e87cd387b268 to your computer and use it in GitHub Desktop.
Just some random things
This file contains hidden or 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
/** | |
* Creates a new GlideRecord Object from inputs, calls query(), then retuns the Object | |
* @private | |
* @param {object} options - Object containing table and any gliderecord methods to call | |
* @returns {GlideRecord} | |
* @example | |
* var options = { | |
* "table": "cmdbi_ci_computer", | |
* "methods": { | |
* "addEncodedQuery": "active=true", | |
* "setLimit": 1, | |
* "query":null | |
* } | |
* } | |
* glideRecordHelper() | |
*/ | |
_glideRecordHelper: function(options) { | |
if (!options || !options.hasOwnProperty("table") || !options.hasOwnProperty("methods")) { | |
throw "Invalid arguments. Example: <add example>" | |
} | |
var grRecord = new GlideRecord(options.table); | |
var objMethods = options.methods; | |
for (var fn in objMethods) { | |
if (typeof grRecord[fn] === "function") { | |
grRecord[fn](objMethods[fn]); | |
} | |
} | |
return grRecord; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment