One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| // This is where we'll save the attachment | |
| var tablename = 'incident'; | |
| var recordSysId = '8d6353eac0a8016400d8a125ca14fc1f'; | |
| var filename = 'snlogo.png'; | |
| // Let's download the ServiceNow Logo | |
| var logoUrl = 'https://instance.service-now.com/images/logos/logo_service-now.png'; | |
| var request = new sn_ws.RESTMessageV2(); | |
| request.setHttpMethod('get'); | |
| request.setEndpoint(logoUrl); |
| (function(){ | |
| var text = ""; | |
| var printl = function(str){ | |
| text = text + str + '\n'; | |
| }; | |
| var println = function(str) { | |
| if(str){ | |
| text = text + str + '\n\n'; |
| #!/bin/bash | |
| # put your instance id here | |
| instance="dev######" | |
| # make sure your password doesn't have shell operators in it | |
| credentials="admin:password" | |
| while true; do | |
| entropy==$RANDOM | |
| outdata="{\"short_description\":\"Automated incident $entropy\"}" |
| /** | |
| * sample http request in servicenow using RESTMessageV2 server side api | |
| * tested running in ServiceNow Geneva Release as a background script in global scope | |
| */ | |
| (function sample_http_request() { | |
| try { | |
| var request = new sn_ws.RESTMessageV2(); | |
| request.setHttpMethod('get'); | |
| request.setEndpoint('https://api.myjson.com/bins/4j985'); | |
| function stringifyGr(record) { | |
| var result = ["{"]; | |
| var multiline = false; | |
| for (var key in record) { | |
| if(record.hasOwnProperty(key)) { | |
| var value = record[key].toString(); | |
| switch (typeof value) { | |
| case "undefined": |
| // 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, |
| <?xml version="1.0" encoding="utf-8" ?> | |
| <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"> | |
| <script> | |
| document.writeln("Prototype.Version: " + Prototype.Version + "<br />"); | |
| document.writeln("Lets look at Global in ServiceNow: <br />"); | |
| myGlobal = this; |
This script uses GlideAggregate to search a field on a table for duplicate values. It then returns the value with duplicates in an array.
var xx = new GlideAggregate('table');
xx.addAggregate('COUNT', 'field');
xx.addHaving('COUNT', 'field', '>', '1');
xx.query();
var answer = []; | <?xml version="1.0" encoding="utf-8" ?> | |
| <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"> | |
| <g:requires name="angular-min.1.3.16.jsdbx" /> | |
| <link href="3ca86ab937380a006215d68543990ef6.cssdbx" rel="stylesheet" type="text/css"></link> | |
| <g2:evaluate var="jvar_stamp"> | |
| var gr = new GlideRecord('sys_ui_script'); | |
| gr.get("13a5ea4d37300a006215d68543990e41"); | |
| gr.getValue('sys_updated_on'); | |
| </g2:evaluate> | |
| <g:requires name="cs-dashboard-script.jsdbx" params="cache=$[jvar_stamp]" /> |