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
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
MIT License | |
Copyright (c) 2017 Timothy Woodruff | |
https://snprotips.com/ | |
This license applies to all public gists on https://gist.github.com/thisnameissoclever | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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
data.orgChart = data.orgChart || {}; | |
data.orgChart.tiers = data.orgChart.tiers || []; | |
data.orgChart.i18n = { | |
avatar: gs.getMessage("{0} avatar"), | |
directReport: gs.getMessage("{0} direct report"), | |
directReports: gs.getMessage("{0} direct reports"), | |
minimumCharacters: gs.getMessage("Please enter {0} or more characters") | |
}; | |
var loopDetected = false; |
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 MSTeamsMessage = Class.create(); | |
MSTeamsMessage.prototype = { | |
/** | |
* | |
* @param {string} [teamsEndpoint=gs.getProperty()] - The MS Teams endpoint for the channel you're trying to post a message to. | |
* You can also specify this later by calling the .setEndpoint() method. | |
*/ | |
initialize : function (teamsEndpoint) { | |
//local init |
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 exampleObj = { | |
"name": "Tim", | |
"age": 31, | |
"groovy": true, | |
"dogs": [ | |
{ | |
"name": "Ezri", | |
"age": 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
//Note: Read from innermost, outward | |
getAllUrlParams( | |
decodeURIComponent( | |
getAllUrlParams( //Get all URL params. Since SN re-encodes everything it passes into page processors like "nav_to.do" for example, this will have one key-val pair. | |
(this.location.href ? this.location.href : window.location.href) //The document URL. Should work for SP, and desktop view. | |
)['uri'] | |
) | |
); | |
var yourParamValue = getAllUrlParams(this.location.href)['YOUR_PARAM_NAME']; |
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 process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) { | |
var body = request.body; | |
var streamBody = body.dataStream; | |
var stringBody = getBodyText(streamBody); | |
gs.log('Message body: ' + stringBody); | |
function getBodyText(streamBody) { |
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 tableName = 'incident'; | |
var sysIDOfRecord = '755d52b137b0b30090b68cf6c3990e6f'; | |
var fileNameSansExtension = 'example text doc'; //Full file name: example text doc.txt | |
var grRecordWithAttachment = new GlideRecord(tableName); | |
grRecordWithAttachment.get(sysIDOfRecord); | |
var gsa = new GlideSysAttachment(); | |
//ONLY works in global | |
var textVal = gsa.get(grRecordWithAttachment, fileNameSansExtension); |
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 recordTable = 'incident'; | |
var idOfRecord = '755d52b137b0b30090b68cf6c3990e6f'; | |
var grAttachment = getAttachmentRecord(recordTable, idOfRecord, 'example text doc.txt', true); | |
var gsaTextFile = new GlideSysAttachment(); | |
var strContents = gsaTextFile.getContent(grAttachment); //ONLY worked in non-global scope | |
gs.info(strContents); | |
/** |
OlderNewer