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
/** | |
* Adds one object to another, nesting the child object into the parent. | |
* this is to get around javascript's immutable handling of objects. | |
* @param name {String} - The name of the property of the parent object, in which to nest the child object. <br />For example, if the name parameter is set to "pickles" then "parent.pickles" will return the child object. | |
* @param child {Object} - The object that should be nested within the parent object. | |
* @param [parent={}] {Object} - The parent object in which to nest the child object. If the parent object is not specified, then the child object is simple nested into an otherwise empty object, which is then returned. | |
* @returns {Object} - A new object consisting of the parent (or an otherwise empty object) with the child object nested within it. | |
* @example | |
* //sets myNewObject to a copy of originalObject, which now also contains the original (yet un-linked) version of itself as a child, under the property name "original" | |
* var myNewObject = addObjToObj("orig |
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
/** | |
* Get the values of each URI param as properties of an object (name-value pairs). | |
* @param url | |
* @returns {{}} | |
* @example - In the URL www.google.com/page?urip=pickles&otheruriparam=bananas, you could use getAllUrlParams().urip to get "pickles". | |
*/ | |
function getAllUrlParams(url) { | |
// get query string from url (optional) or window | |
var queryString = url ? url.split('?')[1] : window.location.search.slice(1); |
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
// opens a new u_error_reporting record from an sc_task record | |
function openOverlay(overlayID, overlayTitle, iframeURI, height, width) { | |
// Instantiate the GlideOverlay | |
// Note: GlideOverlay extends GlideBox, which contains the close() method | |
var overlayWindow = new GlideOverlay({ | |
id: overlayID, | |
title: overlayTitle, | |
iframe: iframeURI, | |
allowOverflowX: true, | |
closeOnEscape: 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
var ClientTimeZoneUtils = Class.create(); | |
ClientTimeZoneUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, { | |
getCurrentTimeInTimeZone: function() { | |
var tz = this.getParameter('sysparm_tz'); | |
var tzu = new TimeZoneUtils(); | |
var gdt = tzu.setTimeZone(tz); | |
return gdt.getDisplayValue(); | |
}, |
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 deployDevConfig() { | |
_deactivateAllNonAdmins(); | |
_disableEmails(); | |
_setHeaderName(); | |
_deactivateLDAPServers(); | |
} | |
function _deactivateAllNonAdmins() { | |
var gr = new GlideRecord('sys_user'); | |
gr.addEncodedQuery('roles!=admin'); |
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 methodsAndProperties = []; | |
var testObj = new GlideFilter('a=b', 'rule'); //TODO: replace this with whatever object you want to test | |
getMethodsAndProperties(methodsAndProperties, testObj); | |
gs.print('\n' + methodsAndProperties.join('\n')); | |
/** | |
* Populates an extant array in-place, of methods and properties of a given object. | |
* @param methodsAndProperties {array} - the array to populate/modify in-place. |
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
https://snprotips.com/blog/2018/3/15/service-catalog-try-in-portal-button |
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
/* | |
Script Include definition: | |
Name: JournalRedactor | |
Client Callable: false | |
Accessible from: All application scopes | |
Additional details: | |
Version: 1.3 | |
Usage documentation: http://redactor.snc.guru/ | |
License: https://gist.github.com/thisnameissoclever/767b8a738b929a0bd943965431061c1e | |
*/ |
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
/***CLASSES***/ | |
class APIClass { | |
/** | |
* An APIClass object | |
* @param name {string} The name of the API class | |
*/ | |
constructor(name, classDesc = '') { | |
this._className = name; | |
this._classDescription = classDesc; | |
/** |
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 DynamicRefQuals= Class.create(); | |
DynamicRefQuals.prototype = Object.extendsObject(AbstractAjaxProcessor, { | |
//Client-callable | |
/* | |
To quickly and easily create a dynamic reference qualifier script, simply add a custom method to this Script Include. | |
Here are the guidelines for modifying this Script Include: | |
1. In the "@author" JSDoc tag of the method your implement, please put your user ID (For example: "twoodruff"). | |
2. See how the getGroupMembersByID and getGroupMembersByName methods are documented, and try to document your method in the same fashion. | |
3. Unless you've got permission from the author, please do not modify anyone else's methods. |
OlderNewer