methodEditor Macroglobalb66385ebdb6b3210995280cb460c3e43b66385ebdb6b3210995280cb460c3e43:1272521126,ddf8006fa0eb3210a2d58a586d928415:1272521126,218a262ee38cbdd413f4174e8b275378:2099634669,698a262e358cbdd4ca8a2f90580c7776:-701476878,67d894c05356321093cc8ce07bda2dca:2099634669,27d894c0f9563210df22d898823728c8:-701476878INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_f5b284010a25810200710e7a99267ab7A common pattern of creating and querying a GlideRecordvargrsyntax_editor_macroglide.maint2008-05-17 07:06:48f5b284010a25810200710e7a99267ab71vargr0f5f326d0c2032108bb2ce4d4ed10ef2globalsyntax_editor_macro_f5b284010a25810200710e7a99267ab7glide.maint2008-05-17 07:50:04var gr = new GlideRecord("$0");
gr.addQuery("name", "value");
gr.query();
if (gr.next()) {
}
]]>372163441390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 12:10:43060f247dc386cf50a9a97b2ed4013125019cf7ed56b00000001JWJ02152026-07-27 12:10:43
vargrEditor Macroglobal0f6385eb736b32106ef230123a60ef8e0f6385eb736b32106ef230123a60ef8e:372163441,6df8006f76eb321006ea30070d5f723e:372163441,6d8a262e938cbdd4e6b8a036208f1ffc:1537638380,a58a262e998cbdd4b871ce2d92721cfb:2145567123,67d894c0aa5632102edee9b0276dfee3:1537638380,a7d894c043563210ee1ddbc80cdf1ce1:2145567123INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_33da1a141bc91510279999fe034bcba1s_GlideRecordDatabaseAccesssyntax_editor_macroJWJ02152022-07-28 14:54:1633da1a141bc91510279999fe034bcba16s_GlideRecordDatabaseAccessglobalglobalsyntax_editor_macro_33da1a141bc91510279999fe034bcba1JWJ02152023-07-21 10:41:36//GlideRecord, addQuery(), orderBy(), setLimit(), getValue(), query(), next(), while(), get()
gs.addInfoMessage("START");
var recLimit = 5;
//List the numbers of the first 5 incident records.
var myGR= new GlideRecord("incident"); //Table names are case sensitive.
myGR.addQuery("active", true); //Only active records.
myGR.orderByDesc("number"); //Sort by number.
myGR.setLimit(recLimit); //Return only 5 records.
myGR.query();
gs.addInfoMessage("Row Count: " + myGR.getRowCount());
var recsFound = myGR.hasNext();
if (recsFound) gs.addInfoMessage("Start Listing of first " + recLimit + " incident records.");
while (myGR.next())
{
gs.addInfoMessage(myGR.getValue("number"));
//gs.addInfoMessage(myGR.number); //This works also. Alternate syntax.
}
if (recsFound) gs.addInfoMessage("Completed the Listing of the first " + recLimit + " incident records.");
//Get a single record by its sys_id.
var quickGR = new GlideRecord("incident");
if (quickGR.get("sys_id", "9d385017c611228701d22104cc95c371")){
gs.addInfoMessage(quickGR.getValue("number"));
gs.addInfoMessage(quickGR.getValue("sys_id"));
}
gs.addInfoMessage("END");]]>1947638732390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42310fa07dc386cf50a9a97b2ed40131b6019cf7ed54970000001JWJ02152026-07-27 13:12:42
s_GlideRecordDatabaseAccessEditor Macroglobal7a6385eb876b32106ee3580971bc145a7a6385eb876b32106ee3580971bc145a:1947638732,6cf8cc2fd2eb3210836a780bc4ca9524:1947638732,994f7e92a264f550a015689a92cf8bc5:-502745767,1cba456b6d88bd50c17f6b4445d110bf:736809906,40c00d892dbaa1107af70a7385a2d931:-911545241,a07a66a6404c35501791d606c1106697:-911545241,218a262eac8cbdd4a30206f0995085ad:-911545241,abd894c07856321055e60da3b00f6a76:-502745767INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_474cd6541bc91510279999fe034bcb90s_LibraryClassAndFunctionUsagesyntax_editor_macroJWJ02152022-07-28 14:59:51474cd6541bc91510279999fe034bcb904s_LibraryClassAndFunctionUsageglobalglobalsyntax_editor_macro_474cd6541bc91510279999fe034bcb90JWJ02152023-04-27 19:17:57//new
//To call a script include library method from other server-side code, instantiate the class using the new keyword, then call named functions as usual.
//To call a script include Classless library function from other server-side code, simply invoke the function name directly.
//Example of instantiating a script include helper class.
var vUtilityFunctions = new PhoenixUtilityFunctions();
//Simple function call on script include helper class.
var vEmail = vUtilityFunctions.getMyEmail();
gs.addInfoMessage("Email from Script Include Utility Function: " + vEmail);
//Simple function call on script include helper class, omitting optional parameter.
var vMyName2 = vUtilityFunctions.getMyNameTwoWays();
gs.addInfoMessage("Name from Script Include Utility Function: " + vMyName2);
//Simple function call on script include helper class, passing in a parameter.
var vMyName = vUtilityFunctions.getMyNameTwoWays(false);
gs.addInfoMessage("Name from Script Include Utility Function: " + vMyName);
var city = zGGB__ClasslessFunction();
gs.addInfoMessage("City from Script Include Classless Function: " + city);]]>-922220208390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42350fa07dc386cf50a9a97b2ed40131b7019cf7ed557c0000001JWJ02152026-07-27 13:12:42
s_LibraryClassAndFunctionUsageEditor Macroglobal076385eb026b3210be9b0b674132be74076385eb026b3210be9b0b674132be74:-922220208,f0f8cc2fe0eb321044c5624259b3c36d:-922220208,298a262e718cbdd4c4add6c555edcbb7:125797925,abd894c0bc563210bf8fda84ef0c948b:125797925INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_5de967a6a9fed30b002ed1984952c99dExample GlideRecord Or Queryvargrorsyntax_editor_macroglide.maint2009-02-10 02:00:245de967a6a9fed30b002ed1984952c99d1vargror0f5f326d0c2032108bb2ce4d4ed10ef2globalsyntax_editor_macro_5de967a6a9fed30b002ed1984952c99dglide.maint2009-02-10 02:00:24var gr = new GlideRecord('$0');
var qc = gr.addQuery('field', 'value1');
qc.addOrCondition('field', 'value2');
gr.query();
while (gr.next()) {
}
]]>600333438390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42390fa07dc386cf50a9a97b2ed40131b8019cf7ed56d40000001JWJ02152026-07-27 13:12:42
vargrorEditor Macroglobal436385eb5f6b32101e172e9745b9ae92436385eb5f6b32101e172e9745b9ae92:600333438,21f8006f9eeb3210b50b9c5e4a309227:600333438,698a662edb8cbdd461c19cac2b3ae700:27690837,a18a262e3f8cbdd49974731556aecdff:-375839572,67d894c036563210ed68d89ee84ae8d9:27690837,a7d894c0e2563210b79b9adc0906dad7:-375839572INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_1571125c1b891510279999fe034bcbb5s_MailScriptsyntax_editor_macroJWJ02152022-07-28 14:11:131571125c1b891510279999fe034bcbb56s_MailScriptglobalglobalsyntax_editor_macro_1571125c1b891510279999fe034bcbb5JWJ02152023-04-27 19:23:48//runMailScript, url, uri, template.print()
//Generate an instance-specific Hyperlink to the Service Portal "My Approvals" page.
(function runMailScript(current, template, email, email_action, event) {
var sAnchorTag = '<a title="Portal Approvals" href="[XXX]/sp?id=approvals" target="_blank" rel="noopener noreferrer nofollow">Portal Approvals</a>';
sAnchorTag = sAnchorTag.replace("[XXX]", gs.getProperty('glide.servlet.uri'));
template.print(sAnchorTag);
})(current, template, email, email_action, event);]]>1120924771390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:423d0fa07dc386cf50a9a97b2ed40131b4019cf7ed55f10000001JWJ02152026-07-27 13:12:42
s_MailScriptEditor Macroglobalc36385eb8d6b321032bda0567294d47ec36385eb8d6b321032bda0567294d47e:1120924771,fcf8cc2f0ceb3210e33c81da096f5858:1120924771,a58a262e8c8cbdd4a92918012e8744bf:484808946,abd894c0115632104eee9e346bd2ed82:484808946INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_98d0a6581bc91510279999fe034bcb08c_ReusableScriptsyntax_editor_macroJWJ02152022-07-28 15:21:0198d0a6581bc91510279999fe034bcb084c_ReusableScriptglobalglobalsyntax_editor_macro_98d0a6581bc91510279999fe034bcb08JWJ02152023-04-27 19:13:06//function, addDecoration(), flash()
//Contains client side reusable functions for the Platform UI only. NOT for use in the Portal, Mobile, or Agent Workspace.
//When updating this script, use Web Browser Ctrl + Shift + Del to clear cached files.
//Call attention to a Mandatory field in a standard way.
function oc_ShowMandatoryField(FieldToHighlight, MessageForDisplay)
{
var ocOrange = "#F57F29"; //Orange color from the Optum logo.
var ocMandatoryDecorationColor = "color-red";
var ocMandatoryField_FlashConstant = -4; //-4 indicates seconds.
var ocMandatoryField_DecorationIcon = "icon-alert"; //! icon with a circle around it.
g_form.addErrorMessage(MessageForDisplay);
//g_form.addDecoration(FieldToHighlight, ocMandatoryField_DecorationIcon, MessageForDisplay);
g_form.addDecoration(FieldToHighlight, ocMandatoryField_DecorationIcon, MessageForDisplay, ocMandatoryDecorationColor);
g_form.flash(FieldToHighlight, ocOrange, ocMandatoryField_FlashConstant);
}]]>893253040390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:423d0fa07dc386cf50a9a97b2ed40131b9019cf7ed525b0000001JWJ02152026-07-27 13:12:42
c_ReusableScriptEditor Macroglobalf26385ebee6b32100e9ac1421c909f13f26385ebee6b32100e9ac1421c909f13:893253040,91f8cc2f1eeb32104dad00bf0282f2d4:893253040,158a262ee48cbdd418f84dc64072fd54:210609221,63d894c0e3563210091859877c5447b9:210609221INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_c2d42a9c1bc91510279999fe034bcbf1s_GlideRecordDatabaseInsertsyntax_editor_macroJWJ02152022-07-28 15:37:04c2d42a9c1bc91510279999fe034bcbf14s_GlideRecordDatabaseInsertglobalglobalsyntax_editor_macro_c2d42a9c1bc91510279999fe034bcbf1JWJ02152023-04-27 19:15:27//initialize, insert
//Use the GlideRecord initialize() function to obtain a new record number.
//Use the GlideRecord insert() function to save the new record to the database.
var grNew= new GlideRecord("rm_story");
grNew.initialize(); //INITIALIZE
grNew.short_description = current.short_description;
grNew.description = sDescription;
grNew.acceptance_criteria = "TBD";
grNew.state = 2;
grNew.product = "cc341ebfdb989490dd5ff27139961948"; //"ServiceNow Production"
grNew.assignment_group = "9ebc734a78dcc500ba880a8925f7fefd"; //"ServiceNow JWJ0215"
grNew.u_customer_lead = current.requested_for;
grNew.parent = current.sys_id;
grNew.insert();
gs.addInfoMessage("New Story Number: " + grNew.number);]]>827807612390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 12:10:43460f247dc386cf50a9a97b2ed4013124019cf7ed54fe0000001JWJ02152026-07-27 12:10:43
s_GlideRecordDatabaseInsertEditor Macroglobal8f6385ebab6b3210022a2b386238265d8f6385ebab6b3210022a2b386238265d:827807612,45f8cc2fceeb321065ae188348e4c3ac:827807612,a98a262e1f8cbdd4203057efdfc5c8af:-1295271109,abd894c02a5632109f9cc4c2cad47297:-1295271109INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_b5e421fe1b58f1d099e265b1604bcbe0s_objectsyntax_editor_macroJWJ02152023-07-31 14:56:22b5e421fe1b58f1d099e265b1604bcbe01s_objectglobalglobalsyntax_editor_macro_b5e421fe1b58f1d099e265b1604bcbe0JWJ02152023-07-31 14:56:34//object, property definition, function definition, stringify(), dot Notation, bracket notation with quotes, testing for properties, for loop with in operator, method calls, JSON.parse(),
//https://www.w3schools.com/js/js_objects.asp
//An object is a built-in data type for storing properties (key-value pairs).
//Data inside an object is unordered, and the values can be of any type.
var apple ={
color: "Green",
family: "Fruit",
price: "$3/kg",
method1: function(arg1, arg2){
return arg1 + arg2 + this.color;
}
};
gs.addInfoMessage(JSON.stringify(apple)); //This will show: {"color":"Green,"family":"Fruit","price:"$3/kg"} Note that methods are not listed.
gs.addInfoMessage("apple:color: " + apple.color); //Use dot notation to reference individual values.
gs.addInfoMessage('apple["color]": ' + apple["color"]); //You may also use bracket notation and key names within quotes
if (apple.bogusKey)
gs.addInfoMessage(apple.bogusKey); //An if statement can be ued to test for undefined properties.
gs.addInfoMessage("Listing properties of apple via for loop, including methods:");
for (var appleKey in apple){
gs.addInfoMessage(appleKey + " : " + apple[appleKey]);
}
gs.addInfoMessage("Method call result:");
gs.addInfoMessage( apple.method1(5, 10)); //Example method call.
//Creating an object from a string.
var sObject = '{ "size":"Large", "color":"Red", "age":"Old" }';
var myObject = JSON.parse(sObject);
gs.addInfoMessage("Listing properties of myObject via for loop:");
for (var myObjectKey in myObject){
gs.addInfoMessage(myObjectKey + " : " + myObject[myObjectKey]);
}]]>-1693914958390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 12:10:43460fa07dc386cf50a9a97b2ed40131bb019cf7ed56160000001JWJ02152026-07-27 12:10:43
s_objectEditor Macroglobal0b6385eb2a6b32103b152e4c368819810b6385eb2a6b32103b152e4c36881981:-1693914958,a0f88c2feaeb321005419686107021c9:-1693914958,194f7e929b64f55061037220becd0dd7:442603651,53d814c085563210ecddbf90bbceedef:442603651INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_f6b0faee475a6110bd0e0d45d36d437as_EventDefinitionAndTriggeringsyntax_editor_macroJWJ02152023-04-22 15:43:44f6b0faee475a6110bd0e0d45d36d437a2s_EventDefinitionAndTriggeringglobalglobalsyntax_editor_macro_f6b0faee475a6110bd0e0d45d36d437aJWJ02152023-04-27 19:14:21gs.eventQueue(
"incident.notifycustomer", //Event Type to send
current, //Glide Record object paremeter
gs.getUserName(), //Event Parameter 1
gs.getUserID() //Event Parameter 2
);
gs.addInfoMessage("Event Sent!");
action.setRedirectURL(current);
]]>-963223296390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 12:10:434a0f247dc386cf50a9a97b2ed4013125019cf7ed54140000001JWJ02152026-07-27 12:10:43
s_EventDefinitionAndTriggeringEditor Macroglobalba6385ebd76b3210e5a84fa7be324250ba6385ebd76b3210e5a84fa7be324250:-963223296,c9f8cc2fb7eb3210c3a5d92dc684d1b7:-963223296,e98a262e2b8cbdd4557ac7fb31c38d98:1541252021,63d894c01b563210ca1c10328357b1aa:1541252021INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_2489c55c472ae510bd0e0d45d36d43e1s_TryBlocksyntax_editor_macroJWJ02152023-04-27 18:42:172489c55c472ae510bd0e0d45d36d43e12s_TryBlockglobalglobalsyntax_editor_macro_2489c55c472ae510bd0e0d45d36d43e1JWJ02152023-09-04 14:07:27//Single LIne Try Catch Block. Catches errors such as use of undefined functions or methods, or attempting to reference fields of a null object.
try { RunServerSideCustomCode(); } catch(err){ var s = "Error caught by catch block: " + err.toString(); gs.error(s); gs.addErrorMessage(s); }
function RunServerSideCustomCode(){
//Write custom code here...
null.MyInvalidFunctionCall();
}]]>1451323231390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42710fa07dc386cf50a9a97b2ed40131b5019cf7ed56880000001JWJ02152026-07-27 13:12:42
s_TryBlockEditor Macroglobalc76385ebdb6b3210c3499c00704c438bc76385ebdb6b3210c3499c00704c438b:1451323231,94f88c2f2eeb32100cb1a42fd980d9c2:1451323231,e769e98ed5c13d9088e22797cc3b0652:1451323231,218a262e238cbdd4fd28b6ca37c00cf9:-941628423,53d814c00a563210a8daf4c96d9a9dec:2138250846INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_9e6442141b891510279999fe034bcb64c_ScratchpadDatabaseAccesssyntax_editor_macroJWJ02152022-07-28 13:14:239e6442141b891510279999fe034bcb6412c_ScratchpadDatabaseAccessglobalglobalsyntax_editor_macro_9e6442141b891510279999fe034bcb64JWJ02152023-04-27 19:13:19//g_scratchpad, g_form.setValue(), g_form.getValue()
//Since client side AJAX code may be slow as it involves asynchronous round trips to the server, a special object called g_scratchpad may be used instead.
//Context: Client Script
//Use the g_scratchpad object from our client side code…
//Retrieve a basic value from a form with g_form.getValue()…
//Set a basic value on a form with g_form.setValue()...
function onLoad() {
g_form.setValue("description", g_form.getValue("description") + " " + g_scratchpad.MyOwnVariable);
}]]>-167711411390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 12:10:43710fa07dc386cf50a9a97b2ed40131ba019cf7ed52850000001JWJ02152026-07-27 12:10:43
c_ScratchpadDatabaseAccessEditor Macroglobal3a6385eb976b321057dabee25cd93e163a6385eb976b321057dabee25cd93e16:-167711411,d5f8cc2fd2eb32102d5ffb9d5f6150ce:-167711411,9d8a262ef08cbdd451750df206578356:-1175909496,63d894c09a5632104a4a80227aecb0b6:-1175909496INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_3402a6981bc91510279999fe034bcb85s_ExcelFileProcessingsyntax_editor_macroJWJ02152022-07-28 15:28:183402a6981bc91510279999fe034bcb853s_ExcelFileProcessingglobalglobalsyntax_editor_macro_3402a6981bc91510279999fe034bcb85JWJ02152023-04-27 19:14:31//GlideExcelParser, GlideSysAttachment, getContentStream(), parse(), getRow()
//Shows how to parse an Excel file so that you can take some action for each record in the given file.
//https://developer.servicenow.com/dev.do#!/reference/api/quebec/server/GEPS-getRow
//Step 0. Strip unnecessary content and formatting form the Excel file so it contains only the data you need and file size is very small < 5 MB.
//Step 1. Attach the Excel File to any record in the system.
//Step 2. Hover over the attachment link, Right Click, and use the Copy Link Address command...
//Step 3. Paste the link address into Notepad to get the sys_id, for example: d97591e58724015089ebc88e8bbb3532
//Step 4. Use that sys_id in the getContentStream() functino call, below.
var parser = new sn_impex.GlideExcelParser();
var attachment = new GlideSysAttachment();
var attachmentStream = attachment.getContentStream("d97591e58724015089ebc88e8bbb3532"); //sys_id of Excel file attached to any ServiceNow record.
parser.parse(attachmentStream);
//Retrieve the column headers
var headers = parser.getColumnHeaders();
var header0 = headers[0];
//Display headers
//gs.addInfoMessage("Excel Header 0: " + header0);
while(parser.next()) {
var row = parser.getRow();
var incidentGr = new GlideRecord("incident");
if (incidentGr.get("number", row[header0])){
gs.addInfoMessage("Major Incident " + row[header0] + " Old Review Status Value: " + incidentGr.getValue("u_review_status"));
incidentGr.setValue("u_review_status", "Complete");
gs.addInfoMessage("Major Incident " + row[header0] + " New Review Status Value: " + incidentGr.getValue("u_review_status"));
incidentGr.update();
}
else
{
gs.addInfoMessage("Major Incident " + row[header0] + " NOT FOUND!");
}
}
parser.close();]]>269102901390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42750fa07dc386cf50a9a97b2ed40131b6019cf7ed54400000001JWJ02152026-07-27 13:12:42
docEditor Macroglobal366385eb376b3210a2915088e5f5bd1d366385eb376b3210a2915088e5f5bd1d:1975655016,a1f8006f2feb321026b14d4b5ac5d839:1975655016,198a262e818cbdd4b4ba14af1451b45d:1672670987,118a262efe8cbdd434f346f5a9079d5c:1881604904,67d894c096563210121c0b80a9a1abde:1672670987,a7d894c0a956321079c7175c15a83bdc:1881604904INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_012a63fe47daa110bd0e0d45d36d43f2s_JavaScriptArrayssyntax_editor_macroJWJ02152023-04-23 14:33:14012a63fe47daa110bd0e0d45d36d43f21s_JavaScriptArraysglobalglobalsyntax_editor_macro_012a63fe47daa110bd0e0d45d36d43f2JWJ02152023-04-27 19:16:08//https://www.w3schools.com/js/js_arrays.asp
//You should use objects when you want the element names to be strings (text).
//You should use arrays when you want the element names to be numbers.
var cars = ["Saab", "Volvo", "BMW"]; //Define an array with square bracket notation.
gs.addInfoMessage("cars: " + cars); //Shows all elements of the array.
gs.addInfoMessage("cars.length: " + cars.length);
cars[0] = "Ford"; //Access array elements with square bracket notation.
gs.addInfoMessage("cars[0]: " + cars[0]); //Shows just one element of the array. The first element is at offest 0 of course.
cars.sort();
gs.addInfoMessage("Sorted Car Array: ");
//Regular for loop.
for (var i = 0; i < cars.length; i++) {
gs.addInfoMessage("cars[" + i + "]: " + cars[i]);
}
cars.pop(); //Removes the last element.
cars.push("Nissan"); //Adds an element to the end of the array.
//forEach loop, which calls a function and passes in each value automatically.
cars.forEach(myFunction);
function myFunction(value) {
gs.addInfoMessage("myFunction(). value: " + value);
}]]>1536614699390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:427d0fa07dc386cf50a9a97b2ed40131b3019cf7ed552f0000001JWJ02152026-07-27 13:12:42
s_JavaScriptArraysEditor Macroglobalc36385eb6a6b32103e5503cb1005b861c36385eb6a6b32103e5503cb1005b861:1536614699,c1f8cc2f5aeb3210d8a6b7b13e9a009a:1536614699,258a262e498cbdd4efe5c9a0eebd1bb2:1891090090,abd894c01a563210492d8316ed700f94:1891090090INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_794dd6941bc91510279999fe034bcb83s_LibraryClassDefinitionsyntax_editor_macroJWJ02152022-07-28 15:02:44794dd6941bc91510279999fe034bcb835s_LibraryClassDefinitionglobalglobalsyntax_editor_macro_794dd6941bc91510279999fe034bcb83JWJ02152023-04-27 19:17:03//prototype, Class.create(), this, function()
//Use the .prototype keyword and the Class.create() method to declare a regular library class containing various (non-AJAX) utility functions.
//Use the this keyword to declare and utilize instance variables.
var PhoenixUtilityFunctions = Class.create();
PhoenixUtilityFunctions.prototype = {
initialize: function() {
},
//Simple object-based function (method).
getMyEmail: function(){
this.userRec = new GlideRecord('sys_user');
this.userRec.get(gs.getUserID());
return this.userRec.getDisplayValue('email');
},
//Simple method which accepts one parameter.
getMyNameTwoWays: function(bFirstLast){
if (bFirstLast === undefined) {bFirstLast = true;}
var vUserId = gs.getUserID();
this.userRec = new GlideRecord('sys_user');
this.userRec.get(vUserId);
var vLastName = this.userRec.getDisplayValue("last_name");
var vFirstName = this.userRec.getDisplayValue("first_name");
var vCompleteName = vFirstName + " " + vLastName;
if (! bFirstLast)
{
vCompleteName = vLastName + ", " + vFirstName;
}
return vCompleteName;
},
type: 'PhoenixUtilityFunctions'
};]]>-1207480777390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:427d0fa07dc386cf50a9a97b2ed40131b8019cf7ed55a40000001JWJ02152026-07-27 13:12:42
s_LibraryClassDefinitionEditor Macroglobal4b6385ebfc6b321068b38292449196774b6385ebfc6b321068b3829244919677:-1207480777,7cf8cc2f1ceb32107995c0a8f40be88c:-1207480777,a18a262e048cbdd45d031988678387ba:887808636,abd894c08c563210318381fd010e808e:887808636INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_9f6cce581b891510279999fe034bcb5cc_GeneratingMessagessyntax_editor_macroJWJ02152022-07-28 13:54:579f6cce581b891510279999fe034bcb5c6c_GeneratingMessagesglobalglobalsyntax_editor_macro_9f6cce581b891510279999fe034bcb5cJWJ02152023-04-27 19:12:32//alert(), addInfoMessage(), showFieldMsg(), jslog(), addDecoration()
//Context: Most client side code.
//Ways to generate messages from client side code:
//Use the alert() function to show a prominent and blocking modal dialog which must be explicitly dismissed for execution to continue.
//Display a message to the user from Client code using g_form.addInfoMessage() or g_form.addErrorMessage()
//Use g_form.addDecoration() to show a small graphic symbol by a form field label. A mouse-over popup hint may be included, and a color may be specified.
//Use g_form.flash() to display a flashing colored background box behind a form field label.
//Use the confirm() function to display a modal popup dialog to get a response (OK or Cancel) from the user before continuing execution.
//Use the jslog() function to write a message to the web browser console.
function onLoad() {
alert("My Alert Message"); //Modal dialog with OK button.
g_form.addErrorMessage("My Error Message"); //Wide message at top of form in Red.
g_form.addInfoMessage("My Info Message"); //Wide message at top of form in Blue.
g_form.showFieldMsg("name", "My Field Message"); //Message UNDERNEATH field. Same width as field. Displayed in blue.
g_form.showFieldMsg("name", "My Field Message - info", "info"); //Again, message UNDERNEATH field. Same width as field. Displayed in blue.
g_form.showFieldMsg("name", "My Field Message - error", "error"); //Message UNDERNEATH field. Same width as field. Displayed in red.
g_form.showFieldMsg("name", "My Field Message - warning", "warning"); //Message UNDERNEATH field. Same width as field. Displayed in orange.
jslog("My jslog Log"); //Sends a message to the web browser console log seen using F12.
g_form.addDecoration("name", "icon-user", "This icon is called icon-user"); //Icon to the left of field.
g_form.addDecoration("name", "icon-tree", "This icon is called icon-tree", "color-green");
g_form.addDecoration("name", "icon-lightbulb", "This icon is called icon-lightbulb", "color-red");
g_form.flash("name", "#AAFACD", -4); //Yellow highlight bar over field for 4 seconds.
var vResult = confirm("My Confirmation Message") ? "User clicked OK" : "User clicked Cancel"; //Modal dialog with 2 buttons.
g_form.addInfoMessage(vResult); //Wide message at top of form in Blue.
} ]]>733560072390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 12:10:43860fa07dc386cf50a9a97b2ed40131ba019cf7ed4d350000001JWJ02152026-07-27 12:10:43
c_GeneratingMessagesEditor Macroglobala66305eba46b32108a2eb19ac877e46ba66305eba46b32108a2eb19ac877e46b:733560072,5df8cc2ff5eb3210ef688483f516bdd9:733560072,918a262e008cbdd4c050e36d89ac0d49:-1596030389,63d894c0e9563210259d4da6cf65afbc:-1596030389INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_c3ba483647de6110bd0e0d45d36d43b5s_JavaScriptObjectssyntax_editor_macroJWJ02152023-04-22 22:17:01c3ba483647de6110bd0e0d45d36d43b51s_JavaScriptObjectsglobalglobalsyntax_editor_macro_c3ba483647de6110bd0e0d45d36d43b5JWJ02152023-04-27 19:16:23//https://www.w3schools.com/js/js_objects.asp
//An object is a built-in data type for storing properties (key-value pairs). Data inside objects are unordered, and the values can be of any type.
var apple = { //Define using curly brackets { }
color: "Green", //Use colons : between the key and the value of each property.
family: "Fruit",
price: "$3/kg",
method1 : function(arg1, arg2) { //Methods are declared by putting the method identifier BEFORE the keyword function, unlike usual.
return arg1 + arg2 + this.color; //Inside an object method, the keyword this refers to the object itself.
}
};
gs.addInfoMessage(JSON.stringify(apple)); //This will show: {"color":"Green","family":"Fruit","price":"$3/kg"} //Note: Methods are Not listed.
gs.addInfoMessage("apple.color: " + apple.color); //Use Dot notation to reference values.
gs.addInfoMessage('apple["color"]: ' + apple["color"]); //Use Bracket notation to reference values via a key name string. Note the quotes.
if (apple.bogusProperty) gs.addInfoMessage(apple.bogusKey); //An if statement can be used to test for: undefined
gs.addInfoMessage("Listing properties of apple object via for loop:");
for (var appleKey in apple) { gs.addInfoMessage(appleKey + " : " + apple[appleKey]); }
gs.addInfoMessage( apple.method1(5,10) ); //Example of calling a method of the object.
//Creating an object from a string.
var sObject = '{"size":"Large", "color":"Red", "age":"Old"}';
var myObject = JSON.parse( sObject );
gs.addInfoMessage("Listing properties of myObject via for loop:");
for (var myObjectKey in myObject) {
gs.addInfoMessage(myObjectKey + " : " + myObject[myObjectKey]);
}]]>1582391755390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 12:10:438a0f247dc386cf50a9a97b2ed4013124019cf7ed55560000001JWJ02152026-07-27 12:10:43
s_JavaScriptObjectsEditor Macroglobalcf6385eb386b3210c23dfd7ba9f19d70cf6385eb386b3210c23dfd7ba9f19d70:1582391755,09f8cc2f0deb3210d844754a9ce6bf93:1582391755,ad8a262e168cbdd4968145f1d4a081b4:1459055168,abd894c0aa563210feb5a3dcbeb6ff91:1459055168INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_fcdf1a181bc91510279999fe034bcb7bs_SetRedirectURLFunctionsyntax_editor_macroJWJ02152022-07-28 15:14:03fcdf1a181bc91510279999fe034bcb7b2s_SetRedirectURLFunctionglobalglobalsyntax_editor_macro_fcdf1a181bc91510279999fe034bcb7bJWJ02152023-04-27 19:18:29//setRedirectURL(), Debug Now
//This custom UI Action, "Debug Now" executs "Scheduled Script Execution" scripts (from table "sysauto_script") in the current session.
//Execution in the current session allows the script debugger (and breakpoints) to be used, and lets you see client side messages such as infoMessages.
try{
var evaluator = new GlideScopedEvaluator();
evaluator.evaluateScript(current, 'script');
action.setRedirectURL(current);
}
catch(e){
gs.addInfoMessage(e);
}]]>-1156429431390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 12:10:438e0f247dc386cf50a9a97b2ed4013125019cf7ed56610000001JWJ02152026-07-27 12:10:43
s_SetRedirectURLFunctionEditor Macroglobal836385eb4f6b3210dd76e0a58393bc88836385eb4f6b3210dd76e0a58393bc88:-1156429431,f4f8cc2f21eb321093ef637c8cef0966:-1156429431,a58a262e848cbdd400d0be3e7390f7f6:-1160922198,abd894c0a55632105163860834390088:-1160922198INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_048e47ea47da6110bd0e0d45d36d4395c_GlideRecordGetReferenceDatabaseAccesssyntax_editor_macroJWJ02152023-04-22 17:53:51048e47ea47da6110bd0e0d45d36d43952c_GlideRecordGetReferenceDatabaseAccessglobalglobalsyntax_editor_macro_048e47ea47da6110bd0e0d45d36d4395JWJ02152023-04-27 19:12:08 //Get all the data about a particular reference field from the Server.
g_form.getReference('caller_id', myCallbackFunction); //caller_id is a field on our form. It must be a Reference field.
g_form.addInfoMessage("getReference() call complete.");
function myCallbackFunction(magicalRecordFromServer)
{
g_form.addInfoMessage("Callback function called.");
if (magicalRecordFromServer) //If data returned from server is non-null...
{
g_form.addInfoMessage('magicalRecordFromServer.name:' + magicalRecordFromServer.name);
g_form.addInfoMessage('magicalRecordFromServer.sys_id:' + magicalRecordFromServer.sys_id);
g_form.setValue('short_description', magicalRecordFromServer.name + " " + magicalRecordFromServer.sys_id);
}
}
]]>71156575390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42b10fa07dc386cf50a9a97b2ed40131b4019cf7ed522b0000001JWJ02152026-07-27 13:12:42
infoEditor Macroglobal3e6385ebb16b3210977c0d2c2364d53c3e6385ebb16b3210977c0d2c2364d53c:1457051794,99f8006fa4eb3210bcf999781e22361b:1457051794,258a262e228cbdd4b2b6b223fbf1ee74:19917249,6d8a262e378cbdd4b6a46bf26b24ce72:1457051794,67d894c041563210f3ed7fec552e3bcf:19917249,a7d894c0e85632103ece477b4d92d8cd:1457051794INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_275a16141bc91510279999fe034bcbf5s_GeneratingMessagessyntax_editor_macroJWJ02152022-07-28 14:50:02275a16141bc91510279999fe034bcbf58s_GeneratingMessagesglobalglobalsyntax_editor_macro_275a16141bc91510279999fe034bcbf5JWJ02152023-04-27 19:23:15//addInfoMessage(), gs.log
//Push messages from the server up to the client form using gs.addInfoMessage() or gs.addErrorMessage().
//Write to table "syslog" with gs.info(), gs.warn(), or gs.error().
//Write to table "syslog" but with a custom Data Source using gs.log(), gs.logWarning, or gs.LogError(); here the custom data source is "Phoenix".
//Use the "Debug Now" custom UI Action to execute this script synchronously in your current user session..
//The "Execute Now" button will run this script asynchronously, in a different session, so you will not see form messages, for example.
gs.addErrorMessage("My Error Message From Server"); //Server-Side code that pushes a message back up to the client: Wide message at top of form in Red.
gs.addInfoMessage("My Info Message From Server"); //Server-Side code that pushes a message back up to the client: Wide message at top of form in Blue.
//SERVER SIDE DEBUGGING
gs.log("My log message"); //Log message to table: syslog.
gs.info("My info message"); //Equivalent to gs.log.
gs.error("My error message");
gs.warn("My warning message");
gs.log("My Phoenix informational message", "Phoenix"); //Log message to table "syslog", Source "Phoenix".
//Shown below form on client, if "System Diagnostics - Session Debug" is turned ON for the "log" object type.
gs.debug("My gs.debug message"); //Also shown in the separate Session Log window.]]>-1557577027390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42b50fa07dc386cf50a9a97b2ed40131b5019cf7ed546f0000001JWJ02152026-07-27 13:12:42
s_GeneratingMessagesEditor Macroglobal366385ebc16b3210daf32688eeb4f057366385ebc16b3210daf32688eeb4f057:-1557577027,f8f8cc2fceeb3210aaa601d25506265f:-1557577027,ed8a262ec08cbdd4ec961eb5b3e87a9d:-562927208,abd894c0cc5632105c1a9c29fc2afe85:-562927208INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_454e4ad81b891510279999fe034bcb01c_GlideAjaxMethodsyntax_editor_macroJWJ02152022-07-28 13:59:26454e4ad81b891510279999fe034bcb016c_GlideAjaxMethodglobalglobalsyntax_editor_macro_454e4ad81b891510279999fe034bcb01JWJ02152023-04-27 19:09:43//GlideAjax, addParam(), getXMLAnswer
//From client side code, to invoke server side code asynchronously, instantiate a custom GlideAjax object.
//Use the addParam() function, and by convention, the parameter named "sysparm_name" to specify which server side function to invoke.
//Additional arbitrary parameters may also be specified with addParam(); In this example "sysparm_Prefix".
//Use getXMLAnswer() to invoke the server-side function and specify a callback function; in this example "finishClientSideWorkONE".
//Use a direct parameter in your callback function to make use of data returned by the server; in this case the parameter is named "answerFromServer".
function onLoad() {
g_form.addInfoMessage("BEGIN Client Script");
var ga = new GlideAjax('zGGB_AjaxFunctions'); //phoenixAjaxUtils is the name of a Server Side Script Include CLASS.
ga.addParam("sysparm_name", "getMyTitle"); //One parameter must be named sysparm_name. It tells which function to invoke on the server.
ga.getXMLAnswer(finishClientSideWork); //Call server function. When it's complete, then invoke "finishClientSideWork" back here on the client.
g_form.addInfoMessage("Additional Code on Client Side 1");
var ga2 = new GlideAjax('zGGB_AjaxFunctions'); //phoenixAjaxUtils is the name of a Server Side Script Include CLASS.
ga2.addParam("sysparm_name", "getMyTitleWithPrefix"); //Tells which function to invoke on the server.
ga2.addParam("sysparm_Prefix", "Sir "); //Additional custom parameter.
ga2.getXMLAnswer(finishClientSideWorkTWO); //Call server function. When complete, then invoke "finishClientSideWorkTWO" back here on the client.
g_form.addInfoMessage("Additional Code on Client Side 2");
}
function finishClientSideWork(answerFomServer)
{
g_form.addInfoMessage("BEGIN finishClientSideWorkONE");
g_form.addInfoMessage("Title from Server: " + answerFomServer);
g_form.addInfoMessage("END finishClientSideWorkONE");
}
function finishClientSideWorkTWO(answerFomServerTWO)
{
g_form.addInfoMessage("BEGIN finishClientSideWorkTWO");
g_form.addInfoMessage("Title from Server w Prefix: " + answerFomServerTWO);
g_form.addInfoMessage("END finishClientSideWorkTWO");
}]]>-377945729390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42b90fa07dc386cf50a9a97b2ed40131b6019cf7ed51d50000001JWJ02152026-07-27 13:12:42
c_GlideAjaxMethodEditor Macroglobal7e6305eb576b321094d931d1aae47f6e7e6305eb576b321094d931d1aae47f6e:-377945729,d1f8006f8ceb3210343c754e78634310:-377945729,958a262ed98cbdd45cfd1f7fde048d4c:1757704770,63d894c045563210d55c1f80436499c5:1757704770INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_5bfdda941bc91510279999fe034bcb4cs_LibraryFunctionDefinitionsyntax_editor_macroJWJ02152022-07-28 15:05:525bfdda941bc91510279999fe034bcb4c2s_LibraryFunctionDefinitionglobalglobalsyntax_editor_macro_5bfdda941bc91510279999fe034bcb4cJWJ02152023-04-27 19:28:21//function
//Context: Script Include
//Example of defining a "Classless" script include function. These may only be called from server side code, NEVER client side code.
//One downside of this method is that it requies a separate script include record for each function.
function PhoenixClasslessFunction()
{
var userSysId = gs.getUserID();
var userRec = new GlideRecord('sys_user');
userRec.get(userSysId);
if (userRec) return userRec.getDisplayValue('city');
}]]>-1442227101390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42bd0fa07dc386cf50a9a97b2ed40131b7019cf7ed55cc0000001JWJ02152026-07-27 13:12:42
jwjEditor Macroglobal726385ebfb6b321048cb6a8c50c16c40726385ebfb6b321048cb6a8c50c16c40:-1423064681,f8623ce719e73210f579a0c8533c13fc:-1423064681,f79bc82f12a33210fa9150757d593020:-1014523474,6cf8cc2f9deb3210fd52256ac6457a2b:288685880,e58a262eef8cbdd4790353cc72204a70:1026098127,f6e8d4c0bf563210122a4e138e6529fb:-1014523474,abd894c0a8563210685b8c9f5cb06279:1026098127INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_9fdf0a1c1b891510279999fe034bcb75s_AjaxFunctionDefinitionsyntax_editor_macroJWJ02152022-07-28 14:04:339fdf0a1c1b891510279999fe034bcb756s_AjaxFunctionDefinitionglobalglobalsyntax_editor_macro_9fdf0a1c1b891510279999fe034bcb75JWJ02152023-04-27 19:13:44//AbstractAjaxProcessor, getParameter()
//Declare a class which extends from AbstractAjaxProcessor to define custom server-side functions callable from the Client.
var zGGB_AjaxFunctions = Class.create();
zGGB_AjaxFunctions.prototype = Object.extendsObject(AbstractAjaxProcessor, {
//Server-side function which takes 0 parameters.
getMyTitle: function() {
gs.log("BEGIN zGGB_AjaxFunctions.getMyTitle", "Phoenix");
this.userRec = new GlideRecord('sys_user');
this.userRec.get(gs.getUserID());
return this.userRec.getDisplayValue('title'); //Pass this value back up to the client.
},
//Server-side function which takes 1 implicit parameter.
getMyTitleWithPrefix: function() {
gs.log("BEGIN zGGB_AjaxFunctions.getMyTitleWithPrefix", "Phoenix");
var sysparm_Prefix = this.getParameter('sysparm_Prefix'); //Parameter is retrieved like so. It is not defined explicitly along with the function.
//Use whatever was passed in from the client as our starting point...
var serverResult = "";
if (sysparm_Prefix){
serverResult = sysparm_Prefix;
}
//Then add whatever we can find from the database...
this.userRec2 = new GlideRecord('sys_user');
this.userRec2.get(gs.getUserID());
serverResult += this.userRec2.getDisplayValue('title');
return serverResult; //Pass this value back up to the client.
},
type: 'zGGB_AjaxFunctions'
});]]>992090971390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 12:10:43ca0fa07dc386cf50a9a97b2ed40131ba019cf7ed539d0000001JWJ02152026-07-27 12:10:43
s_AjaxFunctionDefinitionEditor Macroglobalfa6385eb6a6b32104a5c0a4ad4fefa46fa6385eb6a6b32104a5c0a4ad4fefa46:992090971,41f8cc2fdbeb32100fb37b7ae96ce8c3:992090971,e58a262ee78cbdd47358df00b0507293:1145763288,63d894c0b5563210ed096bfed9e837b0:1145763288INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_d543929c1b891510279999fe034bcb00c_GlideRecordDatabaseAccesssyntax_editor_macroJWJ02152022-07-28 14:19:03d543929c1b891510279999fe034bcb004c_GlideRecordDatabaseAccessglobalglobalsyntax_editor_macro_d543929c1b891510279999fe034bcb00JWJ02152023-04-27 19:09:57//get(), query(), try(), catch()
//Use Client Side GlideRecord get() method to grab data from the server in a Blocking fashion. And demonstrates UI Policy SCRIPT.
//Use Client Side Glide Record query() method to grab data from the server in an Asynchronous fashion.
//Use JavaScript try{} and catch(){} blocks to ensure continued execution if there is an unhandled exception.
function onCondition() {
//Demonstrate use of CLIENT SIDE GlideRecord object and get() method.
//get() function is synchronous, so the client will be "hung up" until the function call returns from the server.
try{
var myClientSideGlideRecord = new GlideRecord("business_unit");
if (myClientSideGlideRecord.get("acba91b01bdd7c109b1376ae034bcb7e"))
{
g_form.addInfoMessage("Record Name from sys_id: " + myClientSideGlideRecord.name);
}
}
catch (err)
{
g_form.addInfoMessage("err:" + err);
}
//query() function with a parameter is asynchronous, so the client does NOT get hung up. alert 7 is displayed before alert 6.
var rec = new GlideRecord('business_unit');
rec.setLimit(5); //Return no more than 5 records.
rec.query(recResponse);
function recResponse(rec) {
while (rec.next()) {
alert("6: " + rec.name + ' exists');
}
}
alert("7");
}]]>861749678390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 12:10:43ce0f247dc386cf50a9a97b2ed4013124019cf7ed51fc0000001JWJ02152026-07-27 12:10:43
forEditor Macroglobal7a6385eb2b6b321068130f383a3243207a6385eb2b6b321068130f383a324320:1303693400,55f8006f5aeb32104d848347722e1121:1303693400,9d8a262e278cbdd446853e60dcf4416d:-801461427,d58a262e0e8cbdd4b9165e1498173c6c:2095615694,67d894c0f856321056aa9fd9b9c457d4:-801461427,a7d894c0bb563210681e9cb49d153dd2:2095615694INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_0ea942181b891510279999fe034bcba5s_CurrentAndPreviousGlideRecordObjectssyntax_editor_macroJWJ02152022-07-28 13:39:270ea942181b891510279999fe034bcba510s_CurrentAndPreviousGlideRecordObjectsglobalglobalsyntax_editor_macro_0ea942181b891510279999fe034bcba5JWJ02152023-04-27 19:13:59//current, previous
//"current" and "previous" are GlideRecord objects defined as parameters in some server-side functions such as Before Update business rules.
//"previous" gives the values of all fields as they were when the record was initially loaded from the database, before any changes were made in the Client UI.
//"current" may be used to change field values before the actual database update happens.
//Context: Business Rule or Workflow
(function executeRule(current, previous /*null when async*/) {
gs.addInfoMessage("previous.description: " + previous.description);
gs.addInfoMessage("current.description: " + current.description);
var sNewDescription = current.description + "X";
gs.addInfoMessage("sNewDescription: " + sNewDescription);
current.description = sNewDescription;
})(current, previous);]]>-1957266662390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42f50fa07dc386cf50a9a97b2ed40131b4019cf7ed53ef0000001JWJ02152026-07-27 13:12:42
s_CurrentAndPreviousGlideRecordObjectsEditor Macroglobal766385ebe86b3210bfaaa708c640dc4d766385ebe86b3210bfaaa708c640dc4d:-1957266662,85f8cc2fb9eb321058068b02bc2ce4bd:-1957266662,618a262e2e8cbdd40d36ca760b375596:-958498951,63d894c0dd563210f2ccaf29de58e7ad:-958498951INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_94f206d01b891510279999fe034bcbf2s_ScratchpadPopulationsyntax_editor_macroJWJ02152022-07-28 13:07:4794f206d01b891510279999fe034bcbf210s_ScratchpadPopulationglobalglobalsyntax_editor_macro_94f206d01b891510279999fe034bcbf2JWJ02152023-04-27 19:24:18//g_scratchpad
//Since client side AJAX code may be slow as it involves asynchronous round trips to the server, a special object called g_scratchpad may be used instead.
//Any "display" type business rule may proactively fill the g_scratchpad object with data which will be available for use on the client.
//Context: Business Rule of type "Display".
//Populate the scratchpad from server side code…
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.MyOwnVariable = "XYZ";
})(current, previous);]]>-1353244784390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42f50fa07dc386cf50a9a97b2ed40131b9019cf7ed563c0000001JWJ02152026-07-27 13:12:42
s_ScratchpadPopulationEditor Macroglobal4f6385eb946b321093990425b58ddf844f6385eb946b321093990425b58ddf84:-1353244784,74f8cc2f4aeb32101951bcde06027539:-1353244784,218a262e0e8cbdd43e02a42c389435c2:-1020354715,abd894c080563210b3682f08f62c617f:-1020354715INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_313f51f21b58f1d099e265b1604bcbc3s_arraysyntax_editor_macroJWJ02152023-07-31 14:31:41313f51f21b58f1d099e265b1604bcbc30s_arrayglobalglobalsyntax_editor_macro_313f51f21b58f1d099e265b1604bcbc3JWJ02152023-07-31 14:31:41//Arrays, pop(), push(), for, forEach
//https://www.w3schools.com/js/js_arrays.asp
//You should use arrays when you want to access elements by their position / number.
//(Use objects, instead, when you want to access elements by name.)
var cars = ["Saab", "Volvo", "BMW"]; //Define an array with square bracket notation.
gs.addInfoMessage("cars: " + cars); //Show all elements of the array. Incredibly easy.
gs.addInfoMessage("cars.length: " + cars.length);
gs.addInfoMessage("cars[0]: " + cars[0]);
cars[0] = "Ford"; //Access array elements with square bracket notation. The first element is at position zero.
gs.addInfoMessage("cars[0]: " + cars[0]);
cars.sort(); //Super easy to sort elements alphabetically.
gs.addInfoMessage("Sorted Car Array: ");
//You can use a regular old "for" loop to access each of the elements in order.
for (var i = 0; i < cars.length; i++){
gs.addInfoMessage("cars[" + i + "]: " + cars[i]);
}
cars.pop(); //Removes the last element of the array.
cars.push("Nissan"); //Adds an element to the end of the array.
//You can use a forEach loop to invoke a function and pass in each value of the array one at a time.
cars.forEach(myFunction);
function myFunction(value){
gs.addInfoMessage("myFunction(). value: " + value);
}]]>1431842442390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42f90fa07dc386cf50a9a97b2ed40131b5019cf7ed53c40000001JWJ02152026-07-27 13:12:42
s_arrayEditor Macroglobal326385eb2f6b3210ff75aa9fce2a724a326385eb2f6b3210ff75aa9fce2a724a:1431842442,e0f8cc2f96eb32100d872d85ea11b21d:1431842442,914f7e92ff64f5508866cdbd3f7557ba:-1471327157,63d814c02f56321021ec1352ab965cf2:-1471327157INSERT_OR_UPDATEglobalcustomersyntax_editor_macro_4659c198472ae510bd0e0d45d36d43dcc_TryBlocksyntax_editor_macroJWJ02152023-04-27 18:41:474659c198472ae510bd0e0d45d36d43dc2c_TryBlockglobalglobalsyntax_editor_macro_4659c198472ae510bd0e0d45d36d43dcJWJ02152023-04-27 19:13:29/* eslint-disable no-console */ //Disables the "Unexpected console statement" warnings.
function RunClientCode(){
try
{
//Write custom code here...
null.MyInvalidFunctionCall();
}
//Catches errors such as the following:
//1) ReferenceError: FunctionXXX is not defined
//2) TypeError: g_form.FunctionXXX is not a function
//3) TypeError: Cannot read properties of null (reading 'MyFunction')
catch (err)
{
var sMessage = "Error caught by catch block: " + err.toString();
g_form.addErrorMessage(sMessage); //alert(sMessage);
console.warn(sMessage);
}
}]]>76823616390fa07dc386cf50a9a97b2ed40131b3falseJWJ02152026-07-27 13:12:42fd0fa07dc386cf50a9a97b2ed40131b6019cf7ed52a90000001JWJ02152026-07-27 13:12:42
c_TryBlockEditor Macroglobal7e6385eb356b32107d5212ff42e736197e6385eb356b32107d5212ff42e73619:76823616,0df8cc2f3beb32106e272955cb7f36c8:76823616,198a262e5e8cbdd489dcf9a725bf1b59:1555971795,63d894c0475632105fa55537128875b3:1555971795
----
=====Add To Update Set 9.6=====
globalGlobalglobalCreates a global UI Action that will add any record (plus attachments & translations) to the active update set*:
-Appears as link at the bottom of each record
-For adding multiple records at once, appears as a drop-down menu option on each list
-To add a field definition and all dependencies (field, label, choices, attributes, overrides), use from the Dictionary record
-When adding a Form record, all dependencies are automatically added
-When adding a Service Portal portal, page, or widget, all dependencies are automatically added
-When adding a Catalog Item or Order Guide, all dependencies are automatically added
-When adding a Variable Set, all dependencies are automatically added
-When adding a Workflow, all sub-flows are automatically added
-When adding a Homepage, all dropzones and contents are automatically added
-When adding a PA Dashboard, all tabs and contents are automatically added (navigate to pa_dashboards.list to add dashboards)
-When adding an Assessment, all dependencies are automatically added
-When adding a Virtual Agent, all dependencies are automatically added including NLU Model(navigate to sys_cs_topic.list to add VA c-onversations)
-When adding a NLU Model, all dependencies are automatically added. If the NLU Model is published in the source instance, a scheduled job is added to the update set to publish it in the target instance 60 seconds after the update set is committed. (** Note: Some users have reported issues or missing dependencies when adding some NLU models. Please allow several minutes for the NLU job to publish to the target instance. If issues continue, use the in-platform NLU model publishing capabilities **)
-When adding a User, all role assignments, group memberships, contained skills, live profile, and delegate settings are automatically added
-When adding a Group, all user memberships, contained roles, skills contained, and group types are automatically added
-When adding an Access Control, all related components are automatically added
-When adding a UI Policy, all child policy actions are automatically added
-When adding a Data Policy, all child policy rules are automatically added
-When adding an Application Menu, all child Modules are automatically added
-When adding an ACL, related role records are automatically added
-When adding a Managed Document, related document revisions and linked HR Document Templates are automatically added
-When adding a REST or SOAP Message, all dependencies are automatically added
-When adding a Scripted REST API or Operation, all dependencies are automatically added
-When adding a Scripted SOAP Service , all dependencies are automatically added
-When adding an ATF Test Suite or ATF Test, all dependencies are automatically added
-When adding a Schedule, all dependencies are automatically added
-Flow Designer is supported for releases starting with New York and Later
-When adding a Guided Tour, all dependencies are automatically added
-When adding a Transform Map, all dependencies are automatically added. If a table being added is part of an import set, the related Transform Map is automatically added.
-When adding an Interactive Filter, all dependencies are automatically added
-When adding a Discovery Schedule or Discovery Range, all dependencies are automatically added
-When adding an Event Management Rule, all dependencies are automatically added
-When adding a Database View, all dependencies are automatically added
-When adding a Robust ETL definition, all dependencies are automatically added
-When adding an AI Search Application, Profile, or Source, all dependencies are automatically added
-When adding a Taxonomy or Topic, all dependencies are automatically added
-When adding Change Models, all states and state transitions are automatically added
-When adding a Decision Table, all dependencies are automatically added
-When adding a UI Page, all access controls are automatically added
-When adding a client callable Script Include, all access controls are automatically added
-When adding an IP Filter Criteria, all dependencies are automatically added
-When adding a Platform Analytics Dashboard, all dependencies are automatically added (utilizes SN-produced code)
-When adding an Impact Scan Engine Suite or Definition, all dependencies are automatically added
*In the case of multi-scope record sets, the UI Action will automatically generate appropriate update sets in each application scope, bundling them under a batch update set for simple promotion to other ServiceNow instances. Requires the 'Update Set Batching (com.glide.system_hierarchy_update_set)' plug-in.
Add to Update Set Global v9.6868b85678780ba9010aa848e8bbb350eloadedsys_remote_update_setben.hollifield2026-07-23 19:10:33ddd0e94187d6cb9060bc84c4dabb35280ben.hollifield2026-07-23 19:10:33INSERT_OR_UPDATEglobalcustomersys_properties_category_m2m_12c64ac61b487010890c2f08b04bcb48cdf73a142fe7cc50c6c690bcf699b6a260068a602c61b487010890c2f08b04bcb5esys_properties_category_m2mben.hollifield2021-05-12 14:28:3812c64ac61b487010890c2f08b04bcb480addToUpdateSetUtils.include_db_view_tables.addToUpdateSetUtilsglobalglobalsys_properties_category_m2m_12c64ac61b487010890c2f08b04bcb48ben.hollifield2021-05-12 14:28:38]]>1039279238ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:3311d0e94187d6cb9060bc84c4dabb352d0199780dc8090000001ben.hollifield2026-07-23 19:10:33
addToUpdateSetUtils.specific_users.addToUpdateSetUtilsCategory Propertyglobaldec6460a27487010b29340d2fbbf64d5dec6460a27487010b29340d2fbbf64d5:-1846194623,dec6460a27487010b29340d2fbbf64d5:-1846194623,e20e7c1afa6b8410102aa576eacdb62d:693037759,e20e7c1afa6b8410102aa576eacdb62d:693037759,e20e7c1afa6b8410102aa576eacdb62d:693037759,c9edf81af06b8410b3f2b06ef4b5a5f3:693037759INSERT_OR_UPDATEglobalcustomersys_properties_45d1c713b4670c106b223b1a55417e65Suppress the addition of 'image/png', 'image/jpeg/, and 'image/gif' attachments to the update set when adding the parent record. These are almost always redundant, as the image data is included in the payload of the parent record. Set this property to 'No' to include them. (Default = Yes)falsefalseaddToUpdateSetUtils.suppress_photo_attachmentssys_propertiesben.hollifield2020-03-20 03:05:1945d1c713b4670c106b223b1a55417e653addToUpdateSetUtils.suppress_photo_attachmentsglobalglobalsys_properties_45d1c713b4670c106b223b1a55417e65ben.hollifield2020-03-20 03:20:17booleantrue]]>-119011802ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:3319d0e94187d6cb9060bc84c4dabb352a0199780dc7fe0000001ben.hollifield2026-07-23 19:10:33
addToUpdateSetUtils.suppress_photo_attachmentsSystem Propertyglobal5c458f93cc670c10781b23a0391e59f15c458f93cc670c10781b23a0391e59f1:-119011802,e45e1fbfa7bed65033f94332511f8d23:-13355280,5c458f93cc670c10781b23a0391e59f1:-119011802,72058b93d5670c10a3a1949f8979ffa2:-1971644503,41054b938d670c101cbed79aee11fac2:-119011802,4ed14b1309670c10f95b28bf5ae2d341:1070532469INSERT_OR_UPDATEglobalcustomersys_script_10f1c2bddb70cc90ca5ab6c968961924<?xml version="1.0" encoding="UTF-8"?><record_update sys_domain="global" table="sys_script"><sys_script action="INSERT_OR_UPDATE"><abort_action>false</abort_action><access>package_private</access><action_delete>false</action_delete><action_insert>false</action_insert><action_query>false</action_query><action_update>false</action_update><active>true</active><add_message>false</add_message><advanced>true</advanced><change_fields>false</change_fields><client_callable>false</client_callable><collection>sys_update_set</collection><condition>gs.getSession().getClientData("listSummary") == "yes"</condition><description/><execute_function>false</execute_function><filter_condition/><is_rest>false</is_rest><message/><name>Add to Update Set Display Summary Msg</name><order>100</order><priority>100</priority><rest_method/><rest_method_text/><rest_service/><rest_service_text/><rest_variables/><role_conditions/><script><![CDATA[(function executeRule(current, previous /*null when async*/) {
var summaryMessage = new global.addToUpdateSetUtils().compileConfirmationMessage();
gs.addInfoMessage(summaryMessage);
})(current, previous);]]></script><sys_class_name>sys_script</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>2019-10-30 13:43:59</sys_created_on><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>10f1c2bddb70cc90ca5ab6c968961924</sys_id><sys_mod_count>0</sys_mod_count><sys_name>Add to Update Set Display Summary Msg</sys_name><sys_overrides/><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_script_10f1c2bddb70cc90ca5ab6c968961924</sys_update_name><sys_updated_by>admin</sys_updated_by><sys_updated_on>2019-10-30 13:43:59</sys_updated_on><template/><when>before_display</when></sys_script><sys_translated_text action="delete_multiple" query="documentkey=10f1c2bddb70cc90ca5ab6c968961924"/></record_update>-697441436ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:3319d0e94187d6cb9060bc84c4dabb352f0199780dc7940000001ben.hollifield2026-07-23 19:10:33
sys_update_set
Add to Update Set Display Summary MsgBusiness Ruleglobal084202fd4e70cc90a78645dd1b6c39c5084202fd4e70cc90a78645dd1b6c39c5:-697441436,084202fd4e70cc90a78645dd1b6c39c5:-697441436INSERT_OR_UPDATEglobalcustomersys_properties_b7dd13942f6bcc50c6c690bcf699b6bdAdd any attachments to the active update set when adding the parent record. Set this property to 'No' to exclude them. (Default = Yes)falsefalseaddToUpdateSetUtils.include_attachmentssys_propertiesadmin2020-03-10 21:26:03b7dd13942f6bcc50c6c690bcf699b6bd7addToUpdateSetUtils.include_attachmentsglobalglobalsys_properties_b7dd13942f6bcc50c6c690bcf699b6bdadmin2020-03-11 20:51:19booleantrue]]>347711602ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:331dd0e94187d6cb9060bc84c4dabb352b0199780dc7bc0000001ben.hollifield2026-07-23 19:10:33
addToUpdateSetUtils.include_attachmentsSystem Propertyglobal8c9f5430c9eb001034d84b825e18f9428c9f5430c9eb001034d84b825e18f942:347711602,d64e9bbfdcbed6506fb34bef3e6c106e:696403048,8c9f5430c9eb001034d84b825e18f942:347711602,208f187c1eab0010898c77d082175216:347711602,bae394309eab00106424a9f0de05e3ad:-388120867,6d836cacf66fcc500a2003708b2f15ba:347711602,68e1a82c586fcc505e15c64f7b2a4c8b:-1282821088,1dc1642cb66fcc504224a37fe04d5e00:-1036715874,41b1ece8826fcc503738fdd28335a582:2047775850,1a61a8e85a6fcc50ae846db3440c539d:-267158305,dced13945f6bcc50863db7bdada033c1:-1534297872INSERT_OR_UPDATEglobalcustomersys_properties_bad838522f6b8410c6c690bcf699b60cList of tables that the Add to Update Set UI Action will not be displayed. Set this property to a comma-separated list of table names.falsefalseaddToUpdateSetUtils.exclude_tablessys_propertiesadmin2020-03-16 14:32:57bad838522f6b8410c6c690bcf699b60c2addToUpdateSetUtils.exclude_tablesglobalglobalsys_properties_bad838522f6b8410c6c690bcf699b60cben.hollifield2022-08-15 20:49:35stringsys_update_set,sys_remote_update_set,sys_update_xml,sys_translated_text]]>938296355ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:3351d0e94187d6cb9060bc84c4dabb352c0199780dc81e0000001ben.hollifield2026-07-23 19:10:33
addToUpdateSetUtils.exclude_tablesSystem Propertyglobal5b49549a57199110c7a706b3aec292245b49549a57199110c7a706b3aec29224:938296355,864e9bbf20bed6504e288ac8f31cf115:-1392951059,5b49549a57199110c7a706b3aec29224:938296355,9ce3435620a74010d71b77cb99b6b51b:490875003,566a7816306b8410dd60ea83f37fa00e:1404216475,4fd874d2d66b8410a8e2754fb439b1c0:1404216475INSERT_OR_UPDATEglobalcustomersys_app_module_00cfdf182f6bcc50c6c690bcf699b6b1truea02b3c250a0a0b50000cc3543c6e463aPreferences for the Add to Update Set Utilityimages/icons/update_merge.gifDIRECTMerge Update SetsMobile10000falsesystem_properties_ui.do?sysparm_title=Add%20To%20Update%20Set%20Preferences&sysparm_category=addToUpdateSetUtilsadminsys_app_moduleadmin2020-03-10 21:34:17global/00cfdf182f6bcc50c6c690bcf699b6b13Add to Update Set Preferencesglobalglobalsys_app_module_00cfdf182f6bcc50c6c690bcf699b6b1admin2020-03-11 20:52:50Add to Update Set Preferencesfalse]]>115207214ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:3355d0e94187d6cb9060bc84c4dabb35290199780dc7d20000001ben.hollifield2026-07-23 19:10:33
Add to Update Set PreferencesModuleglobal32dfd03018eb0010bcfc99dd1f2b6e4732dfd03018eb0010bcfc99dd1f2b6e47:115207214,8d5e1fbfffbed650641e572a40997170:1636715443,32dfd03018eb0010bcfc99dd1f2b6e47:115207214,36f02468a86fcc503c8a3969627c5269:-989694898,f9202398466bcc500dc285ad0f0bceec:-930343834,4ccf1398e66bcc50acb54221260ddfe6:1963145291INSERT_OR_UPDATEglobalcustomersys_properties_category_m2m_31ee5fd42f6bcc50c6c690bcf699b6d1cdf73a142fe7cc50c6c690bcf699b6a23009e7e5fd42f6bcc50c6c690bcf699b6e1sys_properties_category_m2madmin2020-03-10 21:30:3431ee5fd42f6bcc50c6c690bcf699b6d10addToUpdateSetUtils.prevent_default_updatesets.addToUpdateSetUtilsglobalglobalsys_properties_category_m2m_31ee5fd42f6bcc50c6c690bcf699b6d1admin2020-03-10 21:30:34]]>2143971689ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:3355d0e94187d6cb9060bc84c4dabb352d0199780dc7b50000001ben.hollifield2026-07-23 19:10:33
addToUpdateSetUtils.group.add_users.addToUpdateSetUtilsCategory Propertyglobal12c64ac63a4870103368937cfdc78e4712c64ac63a4870103368937cfdc78e47:922304837,12c64ac63a4870103368937cfdc78e47:922304837,73020f13a2670c1054921aeb5ffb18b9:-1718724954,d67f5030eaeb001015db09667faa1d4e:-64787449,b1ee5fd4ad6bcc502516649458d313d0:-64787449,fef77a1454e7cc50c557c64d85bd8301:1219218984INSERT_OR_UPDATEglobalcustomersys_properties_68a602c61b487010890c2f08b04bcb5eInclude all table definitions necessary when adding a Database View (Note: This will also include all fields, views, choices, ACLs, client scripts, business rules, modules, etc for that table - Use with caution). Set this property to 'Yes' to include them. (Default = No)falsefalseaddToUpdateSetUtils.include_db_view_tablessys_propertiesben.hollifield2021-05-12 14:27:5968a602c61b487010890c2f08b04bcb5e3addToUpdateSetUtils.include_db_view_tablesglobalglobalsys_properties_68a602c61b487010890c2f08b04bcb5eben.hollifield2021-05-12 14:55:37booleanfalse]]>1862727623ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:335dd0e94187d6cb9060bc84c4dabb352a0199780dc8180000001ben.hollifield2026-07-23 19:10:33
addToUpdateSetUtils.include_db_view_tablesSystem Propertyglobal1dfcc24e63487010c515e04691beb9f21dfcc24e63487010c515e04691beb9f2:1862727623,294e5bbfe4bed650eb71a84221761fa4:-1677752387,1dfcc24e63487010c515e04691beb9f2:1862727623,b5ac8a0e4c487010903dcbe5f2ba2965:-1519343032,f5174a0ae7487010535cd28a3bfec777:1862727623,74a602c68c487010f19e1a290dc3dc63:-602721473INSERT_OR_UPDATEglobalcustomersys_script_include_6ba1c8a24f5da740d1676bd18110c79a<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_script_include"><sys_script_include action="INSERT_OR_UPDATE"><access>public</access><active>true</active><api_name>global.addToUpdateSetUtils</api_name><caller_access/><client_callable>false</client_callable><description>Utility script to add components to update sets</description><mobile_callable>false</mobile_callable><name>addToUpdateSetUtils</name><sandbox_callable>false</sandbox_callable><script><![CDATA[var addToUpdateSetUtils = Class.create();
addToUpdateSetUtils.prototype = {
initialize: function() {
this.updateSetBatchingURL = "https://docs.servicenow.com/bundle/vancouver-application-development/page/build/system-update-sets/hier-update-sets/concept/us-hier-overview.html";
// Gather user preferences rom system properties
this.includeUsersWithGroups = gs.getProperty("addToUpdateSetUtils.group.add_users", "true") == "true" ? true : false;
this.includeAttachments = gs.getProperty("addToUpdateSetUtils.include_attachments", "true") == "true" ? true : false;
this.suppressPhotoAttachments = gs.getProperty("addToUpdateSetUtils.suppress_photo_attachments", "true") == "true" ? true : false;
this.preventDefaultUpdateSet = gs.getProperty("addToUpdateSetUtils.prevent_default_updatesets", "true") == "true" ? true : false;
this.preventProtectedNLUModels = gs.getProperty("addToUpdateSetUtils.prevent_protected_nlu_models", "true") == "true" ? true : false;
this.includeDbViewTables = gs.getProperty("addToUpdateSetUtils.include_db_view_tables", "true") == "true" ? true : false;
this.updateSetAPI = new GlideUpdateSet();
this.clientSession = gs.getSession();
//Variables for error handling
this.scriptAPIName = "global.addToUpdateSetUtils";
var scriptIncludeGR = new GlideRecord("sys_script_include");
this.scriptSysID = scriptIncludeGR.get("api_name", this.scriptAPIName) ? scriptIncludeGR.getUniqueValue() : "";
//If records are added to an update set from certain tables, downstream issues may arise.
//sys_translated_text records should never be included because of issues during the upgrade process. They are automatically included within the parent XML record. Please see this KB article for details: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0966221
this.excludedTables = ["sys_translated_text"];
},
// Function leveraged by the Add to Update Set UI Action to control visibility
checkDisplayCondition: function(tableRec) {
var excludeTables = gs.getProperty("addToUpdateSetUtils.exclude_tables") + "";
if (!gs.nil(excludeTables)) {
excludeTables = excludeTables.split(',');
for (var z = 0; z < excludeTables.length; z++) {
if (excludeTables[z].trim() == tableRec.getTableName()) {
return false;
}
}
}
var specificUsers = gs.getProperty("addToUpdateSetUtils.specific_users") + "";
if (!gs.nil(specificUsers)) {
specificUsers = specificUsers.split(',');
for (var z = 0; z < specificUsers.length; z++) {
if (specificUsers[z].trim() == gs.getUserName()) {
return true;
}
}
return false;
}
// Default to show Add to Update Set UI Action
return true;
},
/*
* Ensure a child update set name is unique among siblings (same parent).
* If a conflict exists, append a space and a number starting at 2 and
* increment until the name is unique. Returns the unique name string.
*/
_ensureUniqueChildName: function(baseName, parentId) {
if (gs.nil(parentId) || gs.nil(baseName)) {
return baseName;
}
// Normalize and remove an existing numeric suffix (e.g., "Name 2") so we don't get "Name 2 2"
var base = baseName.toString();
// Trim whitespace
base = base.replace(/\s+$/g, '');
// If the name ends with a space followed by a number, strip that segment
// e.g., "My Set 2" -> "My Set". This makes numbering predictable.
var suffixMatch = base.match(/^(.*)\s+(\d+)$/);
if (suffixMatch && suffixMatch.length === 3) {
base = suffixMatch[1];
}
var candidate = base;
var suffix = 2;
// Loop until we find a name that doesn't exist for the same parent
while (true) {
var gr = new GlideRecord('sys_update_set');
gr.addQuery('parent', parentId);
gr.addQuery('name', candidate);
gr.query();
if (!gr.next()) {
return candidate;
}
candidate = base + ' ' + suffix;
suffix++;
}
},
addToUpdateSet: function(tableRec) {
var userMessage = "";
var currentSetID = this.updateSetAPI.get();
if (this.preventDefaultUpdateSet == true && currentSetID == this.updateSetAPI.getDefault()) {
var newLocalSetURL = '<a href="sys_update_set.do?sys_id=-1">New Local Update Set</a>';
userMessage = "You are attempting to add a record to the system default update set, please create a " + newLocalSetURL + " and set that as your current update set.";
gs.addErrorMessage(userMessage);
return;
}
// Check to see if executing UI Action from a list or related list so that final message has all results
var clearSessionVariables;
var glideURIMap = gs.action.getGlideURI().getMap();
var isList = glideURIMap.get("sys_is_list");
isList = gs.nil(isList) ? false : isList;
if (isList) {
var listCheckedItems = this.clientSession.getClientData("listCheckedItems") + "";
if (listCheckedItems == "null") {
this.clientSession.putClientData("listCheckedItems", RP.getParameterValue("sysparm_checked_items"));
clearSessionVariables = true;
} else {
clearSessionVariables = false;
var recID = tableRec.getValue("sys_id");
listCheckedItems = listCheckedItems.split(",");
listCheckedItems.splice(listCheckedItems.indexOf(recID), 1);
if (listCheckedItems.length > 0) {
this.clientSession.putClientData("listCheckedItems", listCheckedItems.toString());
} else {
this.clientSession.clearClientData("listCheckedItems");
}
}
} else {
// Single record so clear variables and present confirmation message
clearSessionVariables = true;
this.clientSession.clearClientData("listCheckedItems");
}
// Session variables are utilized to store components used for the final confirmation message
// Ensure session properties are clear and initialized
this.clientSession.clearClientData("originalSet");
this.clientSession.putClientData("originalSet", currentSetID);
if (clearSessionVariables) {
this.clientSession.clearClientData("setsUtilized");
this.clientSession.putClientData("setsUtilized", "");
this.clientSession.clearClientData("parentSet");
this.clientSession.clearClientData("tablesUtilized");
this.clientSession.putClientData("tablesUtilized", "");
this.clientSession.clearClientData("warningMessages");
this.clientSession.putClientData("warningMessages", "");
this.clientSession.clearClientData("errorMessages");
this.clientSession.putClientData("errorMessages", "");
this.clientSession.clearClientData("listSummary");
}
// Check for table specific scripts and add item to update set
try {
// Check for table specific scripts and add item to update set
var tableName = tableRec.getTableName();
this.checkTable(tableRec, tableName);
} catch (err) {
var errorMessage = (err.message.endsWith(".")) ? err.message.slice(0, -1) : err.message;
errorMessage = "The Add to Update Set Utility encountered an error: " + errorMessage;
if (!gs.nil(err.stack)) {
var fileName = err.fileName.indexOf(this.scriptSysID) == -1 ? err.fileName : this.scriptAPIName;
var sourceName = err.sourceName.split(".");
fileName = '<a href="' + sourceName[0] + ".do?sys_id=" + sourceName[1] + '" target="_blank">' + fileName + '</a>';
errorMessage += " in script " + fileName + " on line number " + err.lineNumber.toString();
}
this._addErrorMessage(errorMessage);
}
// Set user's update set back to the original
var originalSet = this.clientSession.getClientData("originalSet") + "";
if (originalSet != "null") {
if (this.updateSetAPI.get().toString() != originalSet) {
this.updateSetAPI.set(originalSet);
}
this.clientSession.clearClientData("originalSet");
}
// Flush any messages generated by changing of update sets
gs.flushMessages();
/* Special handling for par_dashboards use of ServiceNow 'Unload Dashboard' code */
if (tableRec.getTableName() == 'par_dashboard') {
userMessage = "Dashboard added to update set via ServiceNow's 'Unload Dashboard' process.";
} else {
userMessage = this.compileConfirmationMessage(isList);
}
gs.addInfoMessage(userMessage);
},
compileConfirmationMessage: function(isList) {
if (gs.nil(isList)) {
isList = false;
}
var userMessage = "";
var setsUtilized = this.clientSession.getClientData("setsUtilized") + "";
if (!gs.nil(setsUtilized)) {
var updateSetID = "";
var parentSetID = this.clientSession.getClientData("parentSet") + "";
if (isList) {
setsUtilized = setsUtilized.split(",");
// By default the parent update set is part of the list remove it if it exists so we can point to the right update set
if (parentSetID != "null") {
setsUtilized.splice(setsUtilized.indexOf(parentSetID), 1);
}
if (setsUtilized.length == 1 || parentSetID == "null") {
updateSetID = setsUtilized[0];
} else {
updateSetID = parentSetID;
}
this.clientSession.putClientData("listSummary", "yes");
userMessage = 'Add to Update Set was utilized via list action. Please <a href="sys_update_set.do?sys_id=' + updateSetID + '"><span style="color: #ff0000;">click here to view summary</span></a>.';
} else {
var updateSetList = [];
var updateSetDetailList = {};
var updateSet = new GlideRecord("sys_update_set");
updateSet.addQuery("sys_id", "IN", setsUtilized);
updateSet.query();
while (updateSet.next()) {
updateSetID = updateSet.getValue("sys_id");
var updateSetDetails = {};
updateSetDetails.name = updateSet.getValue("name");
updateSetDetails.scope = updateSet.application.getDisplayValue();
if (parentSetID != updateSetID) {
updateSetList.push(updateSetID);
}
updateSetDetailList[updateSetID] = updateSetDetails;
}
if (updateSetList.length > 1) {
userMessage = '<p><span style="color: #ff0000;"><strong><a style="color: #ff0000;" href="' + this.updateSetBatchingURL + '" target="_blank">Update set batching</a>';
userMessage = userMessage + ' was utilized because multiple scopes were detected. Records added to following update sets:</strong></span></p>';
userMessage = userMessage + '<ul style="list-style-position: inside;">';
userMessage = userMessage + '<li><a href="sys_update_set.do?sys_id=' + parentSetID + '">' + updateSetDetailList[parentSetID].name + ' - ' + updateSetDetailList[parentSetID].scope + '</a></li>';
for (var i = 0; i < updateSetList.length; i++) {
userMessage = userMessage + '<li><a href="sys_update_set.do?sys_id=' + updateSetList[i] + '">' + updateSetDetailList[updateSetList[i]].name + ' - ' + updateSetDetailList[updateSetList[i]].scope + '</a></li>';
}
userMessage = userMessage + '</ul>';
} else {
userMessage = '<p>Record(s) added to update set:</p>';
userMessage = userMessage + '<ul style="list-style-position: inside;"><li>';
userMessage = userMessage + '<a href="sys_update_set.do?sys_id=' + updateSetList[0] + '">' + updateSetDetailList[updateSetList[0]].name + ' - ' + updateSetDetailList[updateSetList[0]].scope + '</a></ul>';
}
var tablesUtilized = this.clientSession.getClientData("tablesUtilized") + "";
tablesUtilized = tablesUtilized.split(",");
if (tablesUtilized.length > 0) {
tablesUtilized.sort();
userMessage = userMessage + '<p>Record(s) from the following tables(s) added:</p>';
userMessage = userMessage + '<ul style="list-style-position: inside;"><li>' + tablesUtilized.join(", ") + '</li></ul>';
}
this.clientSession.clearClientData("setsUtilized");
this.clientSession.clearClientData("parentSet");
this.clientSession.clearClientData("tablesUtilized");
this.clientSession.clearClientData("listSummary");
}
}
var warningMessages = this.clientSession.getClientData("warningMessages") + "";
if ((!isList || gs.nil(updateSetID)) && warningMessages != "null" && warningMessages.length > 0) {
warningMessages = warningMessages.split(",");
userMessage = userMessage + '<p><span style="color: #F4A460;"><strong>Warnings:</strong></span></p>';
userMessage = userMessage + '<ul style="list-style-position: inside;">';
for (var w = 0; w < warningMessages.length; w++) {
if (gs.nil(warningMessages[w]) || warningMessages[w] == "null") continue;
userMessage = userMessage + '<li>' + warningMessages[w] + '</li>';
}
userMessage = userMessage + '</ul>';
this.clientSession.clearClientData("warningMessages");
}
var errorMessages = this.clientSession.getClientData("errorMessages") + "";
if ((!isList || gs.nil(updateSetID)) && errorMessages != "null" && errorMessages.length > 0) {
errorMessages = errorMessages.split(",");
userMessage = userMessage + '<p><span style="color: #ff0000;"><strong>Errors - Please consult your System Administrator:</strong></span></p>';
userMessage = userMessage + '<ul style="list-style-position: inside;">';
for (var e = 0; e < errorMessages.length; e++) {
if (gs.nil(errorMessages[e]) || errorMessages[e] == "null") continue;
userMessage = userMessage + '<li>' + errorMessages[e] + '</li>';
}
userMessage = userMessage + '</ul>';
this.clientSession.clearClientData("errorMessages");
}
return userMessage;
},
_addErrorMessage: function(errorMessage) {
var errorMessages = this.clientSession.getClientData("errorMessages") + "";
if (gs.nil(errorMessage) || errorMessage == "null" || errorMessages.indexOf(errorMessage) > -1) {
//Error message null or already captured
return;
} else {
// split adding an extra comma so checking length
if (gs.nil(errorMessages) || errorMessages.length == 0) {
errorMessages = [];
} else {
errorMessages = errorMessages.split(",");
}
errorMessages.push(errorMessage);
this.clientSession.putClientData("errorMessages", errorMessages.toString());
}
},
checkTable: function(tableRec, tableName) {
var continueProcessing = true;
var processParentTable = false;
/*
* Below specific tables can be called out however the next switch statement below allows you to use parent tables.
* Example is with record producers which extend sc_cat_item and the components are the same.
* If you want to not process parent tables, set processParentTable to false similar to example above.
*/
switch (tableName) {
/********************* Common Tables *************************************/
case "sys_attachment":
this._addAttachment(tableRec, tableName);
continueProcessing = false;
break;
case "sys_user":
this._addUser(tableRec, tableName);
continueProcessing = false;
break;
case "sys_user_group":
this._addGroup(tableRec, tableName);
continueProcessing = false;
break;
case "asmt_metric_type":
this._addAssessment(tableRec, tableName);
continueProcessing = false;
break;
case "sys_db_object":
this._addDbObject(tableRec, tableName);
continueProcessing = false;
break;
case "sys_db_view":
this._addDbView(tableRec, tableName);
continueProcessing = false;
break;
case "sys_dictionary":
this._addField(tableRec, tableName);
continueProcessing = false;
break;
case "item_option_new_set":
this._addVariableSet(tableRec, tableName);
break;
case "sys_ui_form":
this._addFormDependencies(tableRec, tableName);
continueProcessing = false;
break;
case "sys_security_acl":
this._addACLDependencies(tableRec, tableName);
continueProcessing = false;
break;
case "sys_ui_policy":
this._addUIPolicyDependencies(tableRec, tableName);
continueProcessing = false;
break;
case "sys_data_policy2":
this._addDataPolicyDependencies(tableRec, tableName);
continueProcessing = false;
break;
case "sys_app_application":
this._addAppModuleDependencies(tableRec, tableName);
continueProcessing = false;
break;
case "dms_document":
this._addManagedDoc(tableRec, tableName);
continueProcessing = false;
break;
case "sys_atf_test_suite":
this._addATFSuite(tableRec, tableName);
continueProcessing = false;
break;
case "sys_atf_test":
this._addATF(tableRec, tableName);
continueProcessing = false;
break;
case "cmn_schedule":
this._addSchedule(tableRec, tableName);
continueProcessing = false;
break;
case "sys_embedded_tour_guide":
this._addGuidedTour(tableRec, tableName);
continueProcessing = false;
break;
case "sys_ui_page":
this._addUIPage(tableRec, tableName);
continueProcessing = false;
break;
case "sys_script_include":
this._addScriptInclude(tableRec, tableName);
continueProcessing = false;
break;
/********************* Workflow & Integration Tables *********************/
case "wf_workflow":
this._addWorkflow(tableRec, tableName);
continueProcessing = false;
break;
case "sys_cs_topic":
this._addVirtualAgent(tableRec, tableName);
continueProcessing = false;
break;
case "sys_cb_topic":
this._addVirtualAgent(tableRec, tableName);
continueProcessing = false;
break;
case "sys_nlu_model":
this._addNLUModel(tableRec, tableName);
continueProcessing = false;
break;
case "sys_rest_message":
this._addRestMessage(tableRec, tableName);
continueProcessing = false;
break;
case "sys_rest_message_fn":
this._addRestFunction(tableRec, tableName);
continueProcessing = false;
break;
case "sys_ws_definition":
this._addScriptedRestService(tableRec, tableName);
continueProcessing = false;
break;
case "sys_ws_operation":
this._addScriptedRestResource(tableRec, tableName);
continueProcessing = false;
break;
case "sys_web_service":
this._addScriptedSoapService(tableRec, tableName);
continueProcessing = false;
break;
case "sys_soap_message":
this._addSoapMessage(tableRec, tableName);
continueProcessing = false;
break;
case "sys_soap_message_function":
this._addSoapFunction(tableRec, tableName);
continueProcessing = false;
break;
case "sys_hub_flow":
this._addFlow(tableRec, tableName);
continueProcessing = false;
break;
case "sys_hub_action_type_definition":
this._addFlowAction(tableRec, tableName);
continueProcessing = false;
break;
case "sys_transform_map":
this._addTransformMap(tableRec, tableName);
continueProcessing = false;
break;
/********************* Service Portal Tables *****************************/
case "sp_portal":
this._addSPPortal(tableRec, tableName);
continueProcessing = false;
break;
case "sp_page":
this._addSPPage(tableRec, tableName);
continueProcessing = false;
break;
case "sp_widget":
this._addSPWidget(tableRec, tableName);
continueProcessing = false;
break;
case "sp_ng_template":
this._addNgTemplate(tableRec, tableName);
continueProcessing = false;
break;
case "sp_angular_provider":
this._addAngularProvider(tableRec, tableName);
continueProcessing = false;
break;
/********************* Reporting & PA Tables *****************************/
case "sys_portal_page":
this._addPortalPage(tableRec, tableName);
continueProcessing = false;
break;
case "pa_dashboards":
this._addPADashboard(tableRec, tableName);
continueProcessing = false;
break;
case "sys_ui_hp_publisher":
this._addInteractiveFilter(tableRec, tableName);
continueProcessing = false;
break;
case "sys_report":
this._addReport(tableRec, tableName);
continueProcessing = false;
break;
case "pa_widgets":
this._addPAWidget(tableRec, tableName);
continueProcessing = false;
break;
case "pa_cubes":
this._addPAIndicatorSource(tableRec, tableName);
continueProcessing = false;
break;
case "pa_indicators":
this._addPAIndicator(tableRec, tableName);
continueProcessing = false;
break;
case "pa_dimensions":
this._addPABreakdownSource(tableRec, tableName);
continueProcessing = false;
break;
case "pa_breakdowns":
this._addPABreakdown(tableRec, tableName);
continueProcessing = false;
break;
/********************* Event Management Tables *****************************/
case "em_match_rule":
this._addEMRule(tableRec, tableName);
continueProcessing = false;
break;
/********************* Discovery Tables *****************************/
case "discovery_schedule":
this._addDiscoverySchedule(tableRec, tableName);
continueProcessing = false;
break;
case "discovery_range":
this._addDiscoveryRangeSet(tableRec, tableName);
continueProcessing = false;
break;
/********************* ETL Tables *****************************/
case "cmdb_inst_application_feed":
this._addETL(tableRec, tableName);
continueProcessing = false;
break;
/********************* AI Search Tables *****************************/
case "sys_search_context_config":
this._addSearchContext(tableRec, tableName);
continueProcessing = false;
break;
case "ais_search_profile":
this._addAiSearchProfile(tableRec, tableName);
continueProcessing = false;
break;
case "ais_search_source":
this._addAiSearchSource(tableRec, tableName);
continueProcessing = false;
break;
case "ais_datasource":
this._addAiSearchDatasource(tableRec, tableName);
continueProcessing = false;
break;
/********************* Taxonomy Tables *****************************/
case "taxonomy":
this._addTaxonomy(tableRec, tableName);
continueProcessing = false;
break;
case "topic":
this._addTaxonomyTopic(tableRec, tableName);
continueProcessing = false;
break;
case "sn_ex_sp_quick_link":
this._addQuickLink(tableRec, tableName);
continueProcessing = false;
break;
/********************* Change Management Tables *****************************/
case "chg_model":
this._addChangeModel(tableRec, tableName);
continueProcessing = false;
break;
case "sttrm_state":
this._addModelState(tableRec, tableName);
continueProcessing = false;
break;
/********************* Decision Table Tables *****************************/
case "sys_decision":
this._addDecisionTable(tableRec, tableName);
continueProcessing = false;
break;
/********************* IP Filter Criteria *****************************/
case "sys_auth_filter_criteria":
this._addIPFilterCriteria(tableRec, tableName);
continueProcessing = false;
break;
/********************* Platform Analytics Dashboards *****************************/
case "par_dashboard":
this._SNunloadDashboard(tableRec, tableName);
continueProcessing = false;
break;
/********************* Impact Scan Engine Suite *****************************/
case "sn_se_suite":
this._addScanEngineSuite(tableRec, tableName);
continueProcessing = false;
break;
/********************* Impact Scan Engine Definition *****************************/
case "sn_se_definition":
this._addScanEngineDefinition(tableRec, tableName);
continueProcessing = false;
break;
default:
processParentTable = true;
break;
}
if (processParentTable) {
// Check for table needs at parent table level
var tableBase = this._getTableBase(tableName);
switch (tableBase) {
case "sc_cat_item":
this._addCatItem(tableRec, tableName);
continueProcessing = false;
break;
case "kb_knowledge":
this._addKnowledge(tableRec, tableName);
continueProcessing = false;
break;
}
}
//Since a table hasn't been found, check scope specific scripts to find a match, if not just add the single record to the update set
if (continueProcessing) {
if (this._executeScopeScript(tableRec, tableName)) {
// Since no other tables
this.saveRecord(tableRec);
}
}
},
_getTableBase: function(tableName) {
return new global.TableUtils(tableName).getAbsoluteBase() + "";
},
_getTableHierarchy: function(tableName) {
return new global.TableUtils(tableName).getHierarchy() + "";
},
/*
* saveRecord input variables:
* - tableRec = record that will be added to the update set
* - validRecordCheck = by default saveRecord will validate that the record being added to the update set is an actual record in the database
* using the GlideRecord isValidRecord() function. If you have a use case where you want to dynamically create a record and add it to
* an update set, set the parameter to false and the record will be added to the set.
* - executeCustomScript = by default custom addToUpdateSetUtilsCustom scripts will be called after the primary record is added to the update set
* Set this parameter to false where you don't want to execute those scripts.
* It is SUPER IMPORTANT to set this parameter to false in your custom addToUpdateSetUtilsCustom scripts when calling the saveRecord function to
* prevent an infinite loop where saveRecord calls your custom addToUpdateSetUtilsCustom script which then calls saveRecord and so on.
*/
saveRecord: function(tableRec, validRecordCheck, executeCustomScript) {
var skipExcludedTable = false;
for (var i = 0; i < this.excludedTables.length; i++) {
if (this.excludedTables[i].toString().trim() == tableRec.getTableName()) {
skipExcludedTable = true;
}
}
if (skipExcludedTable) {
var errorMessage = "Records from the " + tableRec.getTableName() + " table cannot be added to update sets. Record(s) skipped.";
this._addErrorMessage(errorMessage);
return;
}
if (gs.nil(validRecordCheck)) {
validRecordCheck = true;
}
if (gs.nil(executeCustomScript)) {
executeCustomScript = true;
}
if (validRecordCheck && !tableRec.isValidRecord()) {
return;
}
//Run custom addToUpdateSetUtilsCustom scripts which allow customers to add their custom code to update sets
if (executeCustomScript) {
this._executeCustomScript(tableRec);
}
if (this._checkSetScope(tableRec) == false) {
return;
}
var updateManager = new GlideUpdateManager2();
updateManager.saveRecord(tableRec);
//Check for and add any attachments to the update set if applicable
if (this.includeAttachments) {
this._addAttachments(tableRec);
}
//Check for and add any translations to the update set if applicable
this._addTranslations(tableRec);
//Check for and add application restricted caller acccess to the update set if applicable
if (new GlidePluginManager().isActive("com.glide.scope.access.restricted_caller")) {
this._addRestrictedCallerAccess(tableRec);
}
var tablesUtilized = this.clientSession.getClientData("tablesUtilized") + "";
// split adding an extra comma so checking length
if (tablesUtilized == "null" || tablesUtilized.length == 0) {
tablesUtilized = [];
} else {
tablesUtilized = tablesUtilized.split(",");
}
var tableLabel = tableRec.getClassDisplayValue();
if (tablesUtilized.indexOf(tableLabel) == -1) {
tablesUtilized.push(tableLabel);
}
this.clientSession.putClientData("tablesUtilized", tablesUtilized.toString());
},
_executeScopeScript: function(tableRec, tableName) {
var scriptQuery = "name=addToUpdateSetUtils^sys_scope!=global";
return this._executeScript(scriptQuery, tableRec, tableName);
},
_executeCustomScript: function(tableRec, tableName) {
var scriptQuery = "name=addToUpdateSetUtilsCustom";
return this._executeScript(scriptQuery, tableRec, tableName);
},
_executeScript: function(scriptQuery, tableRec, tableName) {
var continueProcessing = true;
try {
var scriptInclude = new GlideRecord("sys_script_include");
scriptInclude.addEncodedQuery(scriptQuery);
scriptInclude.query();
while (scriptInclude.next()) {
var apiName = scriptInclude.getValue("api_name");
var scriptName = "new " + apiName + "()";
var scopeScript = GlideEvaluator.evaluateString(scriptName);
continueProcessing = scopeScript.checkTable(tableRec, tableName);
if (continueProcessing == false) {
break;
}
}
} catch (err) {
var errorMessage = (err.message.endsWith(".")) ? err.message.slice(0, -1) : err.message;
errorMessage = "The Add to Update Set Utility encountered an error: " + errorMessage;
if (!gs.nil(err.stack)) {
var fileName = apiName;
var sourceName = err.sourceName.split(".");
fileName = '<a href="' + sourceName[0] + ".do?sys_id=" + sourceName[1] + '" target="_blank">' + fileName + '</a>';
errorMessage += " in script " + fileName + " on line number " + err.lineNumber.toString();
}
this._addErrorMessage(errorMessage);
continueProcessing = false;
}
return continueProcessing;
},
_checkSetScope: function(tableRec) {
var currentSetID = this.updateSetAPI.get();
if (this.preventDefaultUpdateSet == true && currentSetID == this.updateSetAPI.getDefault()) {
var newLocalSetURL = '<a href="sys_update_set.do?sys_id=-1">New Local Update Set</a>';
userMessage = "You are attempting to add a record to the system default update set, please create a " + newLocalSetURL + " and set that as your current update set.";
gs.addErrorMessage(userMessage);
return false;
}
var newSetID = currentSetID;
var setsUtilized = this.clientSession.getClientData("setsUtilized") + "";
// split adding an extra comma so checking length
if (setsUtilized == "null" || setsUtilized.length == 0) {
setsUtilized = [];
} else {
setsUtilized = setsUtilized.split(",");
}
var currentSet = new GlideRecord("sys_update_set");
if (!currentSet.get(currentSetID)) {
currentSet.initialize();
}
var currentSetName = currentSet.getValue("name");
var currentSetScope = currentSet.getValue("application");
var parentUpdateSetID = currentSet.getValue("base_update_set");
var tableRecScope = this._getRecordScope(tableRec, "id");
var createParentSet = gs.nil(currentSet.getValue("base_update_set"));
var createChildSet = false;
var updateSet = new GlideRecord("sys_update_set");
if ((tableRecScope != currentSetScope && !gs.nil(parentUpdateSetID)) || currentSet.getValue("base_update_set") == currentSet.getValue("sys_id")) {
updateSet.initialize();
updateSet.addQuery("parent", parentUpdateSetID);
updateSet.addQuery("application", tableRecScope);
updateSet.query();
if (updateSet.next()) {
newSetID = updateSet.getValue("sys_id");
//Verify update set is 'In Progress' otherwise change it
if (updateSet.getValue("state") != "in progress") {
updateSet.state = "in progress";
updateSet.update();
}
} else {
createChildSet = true;
}
} else if (tableRecScope != currentSetScope) {
createChildSet = true;
}
if (createChildSet) {
if (createParentSet) {
// Create parent set
updateSet.initialize();
updateSet.get(currentSetID);
updateSet.name = updateSet.getValue("name") + " - Batch Parent";
updateSet.is_default = false;
parentUpdateSetID = updateSet.insert();
if (currentSetName.indexOf("- Batch Child") == -1) {
currentSet.name = currentSetName + " - Batch Child";
}
currentSet.parent = parentUpdateSetID;
currentSet.update();
}
if (currentSetName.indexOf("- Batch Parent") > -1) {
currentSet.name = currentSetName.replace("Batch Parent", "Batch Child");
}
currentSet.parent = parentUpdateSetID;
currentSet.application = tableRecScope;
currentSet.is_default = false;
// Ensure the child update set name is unique among siblings for this parent
currentSet.name = this._ensureUniqueChildName(currentSet.name, parentUpdateSetID);
newSetID = currentSet.insert();
}
if (currentSetID.toString() != newSetID.toString()) {
currentSetID = newSetID;
this.updateSetAPI.set(currentSetID);
}
if (setsUtilized.toString().indexOf(currentSetID) == -1) {
setsUtilized.push(currentSetID);
}
if (!gs.nil(parentUpdateSetID)) {
if (setsUtilized.toString().indexOf(parentUpdateSetID) == -1) {
setsUtilized.push(parentUpdateSetID);
}
var parentSet = this.clientSession.getClientData("parentSet");
if (gs.nil(parentSet)) {
this.clientSession.putClientData("parentSet", parentUpdateSetID.toString());
}
}
this.clientSession.putClientData("setsUtilized", setsUtilized.toString());
return true;
},
_getRecordScope: function(tableRec, returnFieldName) {
// returnFieldName values are "id" for the sys_id of the sys_scope record or "name" for the scope name
if (gs.nil(returnFieldName)) {
returnFieldName = "id";
}
// Default to global
var scopeDetails = {};
scopeDetails.id = "global";
scopeDetails.name = "Global";
if (tableRec.isValidField("sys_scope") && !gs.nil(tableRec.getValue("sys_scope"))) {
scopeDetails.id = tableRec.getValue('sys_scope');
scopeDetails.name = tableRec.sys_scope.scope.toString();
} else if (tableRec.getTableName() == "sys_choice") {
var choiceSet = new GlideRecord("sys_choice_set");
choiceSet.addQuery("name", tableRec.getValue("name"));
choiceSet.addQuery("element", tableRec.getValue("element"));
choiceSet.query();
if (choiceSet.next()) {
scopeDetails.id = choiceSet.getValue('sys_scope');
scopeDetails.name = choiceSet.sys_scope.scope.getDisplayValue();
}
/* If returnFieldName == "name" as last resort check the sys_meta for the record's scope name
* This is important when executing the scope scripts for table permission purposes and scope specific processing
* This is NOT needed when the scope ID is needed when adding a record to an update set so that the Customer Updates are added to the right scope
*/
} else if (returnFieldName == "name" && !gs.nil(tableRec.sys_meta) && !gs.nil(tableRec.sys_meta.sys_scope)) {
scopeDetails.id = tableRec.sys_meta.sys_scope.toString();
var sysApp = new GlideRecord("sys_scope");
if (sysApp.get(scopeDetails.id)) {
scopeDetails.name = sysApp.getValue("scope");
}
}
return scopeDetails[returnFieldName];
},
/********************* Table Specific Functions *********************/
/********************* Begin Attachment Functions *********************/
//Add an attachment to the update set
_addAttachment: function(tableRec, tableName) {
this.saveRecord(tableRec);
this._addAttachmentDocs(tableRec, tableName);
},
//Add all record attachments to the update set
_addAttachments: function(tableRec, tableName) {
//If the current record *has* attachments, add those
if (gs.nil(tableName)) {
tableName = tableRec.getTableName();
}
//Process the main sys_attachment record
var attach = new GlideRecord("sys_attachment");
attach.addQuery("table_name", "CONTAINS", tableName); //Using contains search since images have a table prefix of ZZ_YY
attach.addQuery("table_sys_id", tableRec.getUniqueValue());
if (this.suppressPhotoAttachments) {
attach.addQuery('content_type', '!=', 'image/png');
attach.addQuery('content_type', '!=', 'image/jpeg');
attach.addQuery('content_type', '!=', 'image/gif');
}
attach.query();
while (attach.next()) {
this.saveRecord(attach);
//Process each sys_attachment_doc chunk
this._addAttachmentDocs(attach, "sys_attachment");
}
},
//Add attachment chunks to the update set
_addAttachmentDocs: function(tableRec, tableName) {
var attach_doc = new GlideRecord("sys_attachment_doc");
attach_doc.addQuery("sys_attachment", tableRec.getUniqueValue());
attach_doc.orderBy("position");
attach_doc.query();
while (attach_doc.next()) {
this.saveRecord(attach_doc);
}
},
/********************* End Attachment Functions *********************/
//Add record translations to the update set
_addTranslations: function(tableRec) {
//If the current record *has* translations, add those
// sys_translated_text records are automatically added with parent record and are part of this.excludedTables variable
var tableHierarchy = new global.TableUtils(tableRec.getTableName()).getTables().toArray();
// tableHierarchy isn't a real array so convert to array and remove sys_metadata
var tableList = [];
for (var i = 0; i < tableHierarchy.length; i++) {
var tableName = tableHierarchy[i];
if (!tableName.startsWith("sys_")) {
tableList.push(tableName);
}
}
var fieldList = [];
var translatedField = new GlideAggregate("sys_translated");
translatedField.addAggregate("count");
translatedField.addAggregate("count(distinct", "element");
translatedField.addQuery("name", "IN", tableList);
translatedField.query();
while (translatedField.next()) {
var count = translatedField.getAggregate("count");
if (count > 1) {
fieldList.push(translatedField.getValue('element'));
}
}
var translationList = [];
for (var f = 0; f < fieldList.length; f++) {
var fieldName = fieldList[f];
translationList.push(tableRec.getValue(fieldName));
}
translatedField = new GlideRecord("sys_translated");
translatedField.addQuery("name", "IN", tableList.toString());
translatedField.addQuery("element", "IN", fieldList.toString());
translatedField.addQuery("value", "IN", translationList.toString()).addOrCondition("label", "IN", translationList.toString());
translatedField.query();
while (translatedField.next()) {
this.saveRecord(translatedField);
}
},
_addRestrictedCallerAccess: function(tableRec) {
var recID = tableRec.getValue("sys_id");
var restrictedCallerAccess = new GlideRecord("sys_restricted_caller_access");
restrictedCallerAccess.addQuery("status", 2); //Allowed
restrictedCallerAccess.addQuery("source", recID).addOrCondition("target", recID);
restrictedCallerAccess.query();
while (restrictedCallerAccess.next()) {
this.saveRecord(restrictedCallerAccess);
}
},
/********************* Begin KB Functions *********************/
//Add KB Article and all dependencies to the update set
_addKnowledge: function(tableRec, tableName) {
this._addKnowledgeArticle(tableRec, tableName);
var canReadList = []
var cannotReadList = [];
if (!tableRec.can_read_user_criteria.nil()){
canReadList = tableRec.getValue('can_read_user_criteria').split(",");
}
if (!tableRec.cannot_read_user_criteria.nil()){
cannotReadList = tableRec.getValue('cannot_read_user_criteria').split(",");
}
// Check to ensure Knowledge Blocks plugin is active
if (new GlidePluginManager().isActive("com.snc.knowledge_blocks")) {
var knowledgeBlockM2M = new GlideRecord("m2m_kb_to_block_history");
knowledgeBlockM2M.addQuery("knowledge", tableRec.getUniqueValue());
knowledgeBlockM2M.query();
while (knowledgeBlockM2M.next()) {
this.saveRecord(knowledgeBlockM2M);
var knowledgeBlock = knowledgeBlockM2M.knowledge_block.getRefRecord();
this._addKnowledgeArticle(knowledgeBlock, knowledgeBlock.getTableName());
var userCriteriaID;
var blockCanReadList = [];
if (!knowledgeBlock.can_read_user_criteria.nil()){
blockCanReadList = knowledgeBlock.getValue('can_read_user_criteria').split(",");
}
for (var c = 0; c < blockCanReadList.length; c++) {
userCriteriaID = blockCanReadList[c].toString();
if (canReadList.toString().indexOf(userCriteriaID) == -1) {
canReadList.push(userCriteriaID);
}
}
var blockCannotReadList = [];
if (!knowledgeBlock.cannot_read_user_criteria.nil()){
blockCannotReadList = knowledgeBlock.getValue('cannot_read_user_criteria').split(",");
}
for (var n = 0; n < blockCannotReadList.length; n++) {
userCriteriaID = blockCannotReadList[n].toString();
if (cannotReadList.toString().indexOf(userCriteriaID) == -1) {
cannotReadList.push(userCriteriaID);
}
}
}
}
this._addUserCriteria(canReadList, cannotReadList);
},
_addKnowledgeArticle: function(tableRec, tableName) {
this.saveRecord(tableRec);
var kbCategory = tableRec.kb_category.getRefRecord();
this.saveRecord(kbCategory);
this._addAttachments(tableRec, tableName);
// Check to ensure Knowledge Management Advanced plugin is active
if (new GlidePluginManager().isActive("com.snc.knowledge_advanced")) {
var kbVersion = tableRec.version.getRefRecord();
this.saveRecord(kbVersion);
var kbSummary = tableRec.summary.getRefRecord();
this.saveRecord(kbSummary);
}
return tableRec;
},
/********************* End KB Functions *********************/
//Add user record and dependencies to the update set
_addUser: function(tableRec, tableName) {
var userID;
if (typeof tableRec == "string") {
userID = tableRec;
tableRec = new GlideRecord("sys_user");
tableRec.get(userID);
}
this.saveRecord(tableRec);
userID = tableRec.getValue("sys_id");
var userRole = new GlideRecord("sys_user_has_role");
userRole.addQuery("user", userID);
userRole.addQuery("inherited", false);
userRole.query();
while (userRole.next()) {
this.saveRecord(userRole);
}
var userGroup = new GlideRecord("sys_user_grmember");
userGroup.addQuery("user", userID);
userGroup.query();
while (userGroup.next()) {
this.saveRecord(userGroup);
}
var userDelegate = new GlideRecord("sys_user_delegate");
userDelegate.addQuery("user", userID);
userDelegate.query();
while (userDelegate.next()) {
this.saveRecord(userDelegate);
}
if (new GlidePluginManager().isActive("com.snc.skills_management")) {
var userSkill = new GlideRecord("sys_user_has_skill");
userSkill.addQuery("user", userID);
userSkill.query();
while (userSkill.next()) {
this.saveRecord(userSkill);
}
}
var liveProfile = new GlideRecord("live_profile");
liveProfile.addQuery("document", userID);
liveProfile.query();
if (liveProfile.next()) {
this.saveRecord(liveProfile);
try {
//Add community profile
new sn_communities.addToUpdateSetUtils()._addCommunityProfile(liveProfile.getValue("sys_id"));
} catch (err) {
}
}
// Add HR Profile but check to ensure Human Resources Scoped App: Core plugin is active first
if (new GlidePluginManager().isActive("com.sn_hr_core")) {
try {
new sn_hr_core.addToUpdateSetUtils()._addHRProfile(userID);
} catch (err) {
}
}
var bookmark = new GlideRecord("sys_ui_bookmark");
bookmark.addQuery("user", userID);
bookmark.query();
while (bookmark.next()) {
this.saveRecord(bookmark);
}
},
//Add group record and dependencies to the update set
_addGroup: function(tableRec, tableName) {
var groupID;
if (typeof tableRec == "string") {
groupID = tableRec;
tableRec = new GlideRecord("sys_user_group");
tableRec.get(groupID);
}
this.saveRecord(tableRec);
groupID = tableRec.getValue("sys_id");
var groupTypes = tableRec.getValue("type");
if (!gs.nil(groupTypes)) {
var groupTypeList = groupTypes.toString().split(",");
for (var i = 0; i < groupTypeList.length; i++) {
var groupType = new GlideRecord("sys_user_group_type");
if (groupType.get(groupTypeList[i])) {
this.saveRecord(groupType);
}
}
}
var groupRole = new GlideRecord("sys_group_has_role");
groupRole.addQuery("group", groupID);
groupRole.query();
while (groupRole.next()) {
this.saveRecord(groupRole);
}
if (this.includeUsersWithGroups && !gs.nil(tableRec.getValue("manager"))) {
this._addUser(tableRec.getValue("manager"));
}
var groupMember = new GlideRecord("sys_user_grmember");
groupMember.addQuery("group", groupID);
groupMember.query();
while (groupMember.next()) {
this.saveRecord(groupMember);
if (this.includeUsersWithGroups) {
this._addUser(groupMember.getValue("user"));
}
}
if (new GlidePluginManager().isActive("com.snc.skills_management")) {
var groupSkill = new GlideRecord("sys_group_has_skill");
groupSkill.addQuery("group", groupID);
groupSkill.query();
while (groupSkill.next()) {
this.saveRecord(groupSkill);
}
}
//Check for child groups and recursively gather them
var childGroup = new GlideRecord("sys_user_group");
childGroup.addQuery("parent", groupID);
childGroup.query();
while (childGroup.next()) {
this._addGroup(childGroup);
}
},
//Add schedule record and dependencies to the update set
_addSchedule: function(tableRec, tableName) {
var scheduleID;
if (typeof tableRec == "string") {
scheduleID = tableRec;
tableRec = new GlideRecord("cmn_schedule");
tableRec.get(scheduleID);
}
this.saveRecord(tableRec);
scheduleID = tableRec.getValue("sys_id");
//Add schedule entries
var scheduleEntry = new GlideRecord("cmn_schedule_span");
scheduleEntry.addQuery("schedule", scheduleID);
scheduleEntry.query();
while (scheduleEntry.next()) {
this.saveRecord(scheduleEntry);
}
//Add child schedules
var childSchedule = new GlideRecord("cmn_other_schedule");
childSchedule.addQuery("schedule", scheduleID);
childSchedule.query();
while (childSchedule.next()) {
this._addSchedule(childSchedule.getValue('child_schedule'));
this.saveRecord(childSchedule);
}
},
/********************* Begin Catalog & Workflow Functions *********************/
//Add Catalog Item and all dependencies to the update set
_addCatItem: function(tableRec, tableName) {
this.saveRecord(tableRec);
var catItemID = tableRec.getUniqueValue();
var variableSetList = [];
var variableSetM2M = new GlideRecord("io_set_item");
variableSetM2M.addQuery("sc_cat_item", catItemID);
variableSetM2M.query();
while (variableSetM2M.next()) {
this.saveRecord(variableSetM2M);
var variableSet = variableSetM2M.variable_set.getRefRecord();
this.saveRecord(variableSet);
variableSetList.push(variableSet.getUniqueValue());
}
var variableQuery = "cat_item=" + catItemID;
if (variableSetList.length > 0) {
variableQuery = variableQuery + "^ORvariable_setIN" + variableSetList.toString();
}
this._addCatItemConfigDependencies(variableQuery);
var availableForList = [];
var availableForM2M = new GlideRecord("sc_cat_item_user_criteria_mtom");
availableForM2M.addQuery("sc_cat_item", catItemID);
availableForM2M.query();
while (availableForM2M.next()) {
this.saveRecord(availableForM2M);
availableForList.push(availableForM2M.getValue("user_criteria"));
}
var notAvailableForList = [];
var notAvailableForM2M = new GlideRecord("sc_cat_item_user_criteria_no_mtom");
notAvailableForM2M.addQuery("sc_cat_item", catItemID);
notAvailableForM2M.query();
while (notAvailableForM2M.next()) {
this.saveRecord(notAvailableForM2M);
notAvailableForList.push(notAvailableForM2M.getValue("user_criteria"));
}
this._addUserCriteria(availableForList, notAvailableForList);
var itemCategory = new GlideRecord("sc_cat_item_category");
itemCategory.addQuery("sc_cat_item", catItemID);
itemCategory.query();
while (itemCategory.next()) {
this.saveRecord(itemCategory);
var scCategory = itemCategory.sc_category.getRefRecord();
this.saveRecord(scCategory);
}
var itemCatalog = new GlideRecord("sc_cat_item_catalog");
itemCatalog.addQuery("sc_cat_item", catItemID);
itemCatalog.query();
while (itemCatalog.next()) {
this.saveRecord(itemCatalog);
var scCatalog = itemCatalog.sc_catalog.getRefRecord();
this.saveRecord(scCatalog);
}
if (!gs.nil(tableRec.getValue('workflow'))) {
var itemWorkflow = tableRec.workflow.getRefRecord();
this._addWorkflow(itemWorkflow);
}
if (tableRec.isValidField("flow_designer_flow") && !gs.nil(tableRec.getValue('flow_designer_flow'))) {
this._addFlow(tableRec.getValue('flow_designer_flow'));
}
this._addServiceFulfillment(catItemID);
if (!gs.nil(tableRec.getValue('template'))) {
this._addTemplate(tableRec.getValue('template'));
}
if (tableName == "sc_cat_item_guide") {
var orderGuideRule = new GlideRecord("sc_cat_item_guide_items");
orderGuideRule.addQuery("guide", catItemID);
orderGuideRule.query();
while (orderGuideRule.next()) {
this.saveRecord(orderGuideRule);
// TODO recursively get cat items and child records
var orderGuideRuleItem = orderGuideRule.item.getRefRecord();
this.saveRecord(orderGuideRuleItem);
var varAssignment = new GlideRecord("sc_item_variable_assignment");
varAssignment.addQuery("rule", orderGuideRule.getValue("sys_id"));
varAssignment.query();
while (varAssignment.next()) {
this.saveRecord(varAssignment);
}
}
}
if (tableName == "pc_software_cat_item" || tableName == "pc_hardware_cat_item") {
var vendorCatItem = new GlideRecord("pc_vendor_cat_item");
vendorCatItem.addQuery("product_catalog_item", catItemID);
vendorCatItem.query();
while (vendorCatItem.next()) {
this.saveRecord(vendorCatItem);
}
}
},
//Add workflow to the update set
_addWorkflow: function(record, tableName) {
this._gatherChildWorkflows(record);
this.saveRecord(record);
},
//Recursively gather all child workflows
_gatherChildWorkflows: function(workflow) {
//Get published workflow version
var workflowVersion = new GlideRecord("wf_workflow_version");
workflowVersion.addQuery("workflow", workflow.getUniqueValue());
workflowVersion.addQuery("published", true);
workflowVersion.query();
while (workflowVersion.next()) {
//Get sub-workflow instances
var subWorkflowInstance = new GlideRecord("wf_workflow_instance");
subWorkflowInstance.addQuery("workflow_version", workflowVersion.getUniqueValue());
subWorkflowInstance.query();
while (subWorkflowInstance.next()) {
//Get subWorkflows
var subWorkflow = new GlideRecord("wf_workflow");
subWorkflow.addQuery("sys_id", subWorkflowInstance.getValue('workflow'));
subWorkflow.query();
if (subWorkflow.next()) {
this._gatherChildWorkflows(subWorkflow);
this.saveRecord(subWorkflow);
}
}
}
},
_addFlow: function(tableRec, tableName) {
var recID;
if (typeof tableRec == "string") {
recID = tableRec;
tableRec = new GlideRecord("sys_hub_flow");
tableRec.get(recID);
}
recID = tableRec.getValue("sys_id");
this.saveRecord(tableRec);
// The composite flow sys_update_xml doesn't include a necessary record when inputs are "complex" such as Object
// Check to see if there are any complex inputs and add those since sys_complex_object records are not automatically added
var stringMatch = "co_type_name=";
var objectIDs = [];
var flowInput = new GlideRecord("sys_hub_flow_input");
flowInput.addQuery("model", recID);
flowInput.addQuery("attributes", "CONTAINS", "uiType=object");
flowInput.addQuery("attributes", "CONTAINS", stringMatch);
flowInput.query();
while (flowInput.next()) {
var attributeList = flowInput.getValue("attributes").toString().split(",");
for (var i = 0; i < attributeList.length; i++) {
var attribute = attributeList[i];
if (attribute.startsWith(stringMatch)) {
var attributeValue = attribute.replace(stringMatch, "");
objectIDs.push(attributeValue);
}
}
}
if (objectIDs.length > 0) {
var complexObject = new GlideRecord("sys_complex_object");
complexObject.addQuery("name", "IN", objectIDs.toString());
complexObject.query();
while (complexObject.next()) {
this.saveRecord(complexObject);
}
}
},
_addFlowAction: function(tableRec, tableName) {
var recID;
if (typeof tableRec == "string") {
recID = tableRec;
tableRec = new GlideRecord("sys_hub_action_type_definition");
tableRec.get(recID);
}
recID = tableRec.getValue("sys_id");
this.saveRecord(tableRec);
// The action sys_update_xml doesn't include a necessary record when inputs are "complex" such as Object
// Check to see if there are any complex inputs and add those since sys_complex_object records are not automatically added
var stringMatch = "co_type_name=";
var objectIDs = [];
var actionInput = new GlideRecord("sys_hub_action_input");
actionInput.addQuery("model", recID);
actionInput.addQuery("attributes", "CONTAINS", "uiType=object");
actionInput.addQuery("attributes", "CONTAINS", stringMatch);
actionInput.query();
while (actionInput.next()) {
var attributeList = actionInput.getValue("attributes").toString().split(",");
for (var i = 0; i < attributeList.length; i++) {
var attribute = attributeList[i];
if (attribute.startsWith(stringMatch)) {
var attributeValue = attribute.replace(stringMatch, "");
objectIDs.push(attributeValue);
}
}
}
if (objectIDs.length > 0) {
var complexObject = new GlideRecord("sys_complex_object");
complexObject.addQuery("name", "IN", objectIDs.toString());
complexObject.query();
while (complexObject.next()) {
this.saveRecord(complexObject);
}
}
},
//Add Service Fulfillment Stages & Steps
_addServiceFulfillment: function(catItemID) {
var serviceFulfillmentStage = new GlideRecord('sc_service_fulfillment_stage');
serviceFulfillmentStage.addQuery('cat_item', catItemID);
serviceFulfillmentStage.query();
while (serviceFulfillmentStage.next()) {
this.saveRecord(serviceFulfillmentStage);
var serviceFulfillmentStep = new GlideRecord('sc_service_fulfillment_step');
serviceFulfillmentStep.addQuery('service_fulfillment_stage', serviceFulfillmentStage.getUniqueValue());
serviceFulfillmentStep.query();
while (serviceFulfillmentStep.next()) {
this.saveRecord(serviceFulfillmentStep);
}
}
},
//Add variable set to the update set
_addVariableSet: function(tableRec, tableName) {
var variableQuery = "variable_set=" + tableRec.getUniqueValue();
this._addCatItemConfigDependencies(variableQuery);
this.saveRecord(tableRec);
},
//Add variables, client scripts, and UI policies to the update set
_addCatItemConfigDependencies: function(itemQuery) {
var warningMessages = this.clientSession.getClientData("warningMessages") + "";
// split adding an extra comma so checking length
if (warningMessages.length == 0) {
warningMessages = [];
} else {
warningMessages = warningMessages.split(",");
}
var variableList = [];
var variables = new GlideRecord("item_option_new");
variables.addEncodedQuery(itemQuery);
variables.query();
while (variables.next()) {
this.saveRecord(variables);
if ((variables.getValue("map_to_field") == true && variables.getValue('field').startsWith("u_")) || variables.getValue('name').startsWith("u_")) {
var warningMessage;
if (!gs.nil(variables.cat_item)) {
var catItem = variables.cat_item.getRefRecord();
warningMessage = '<a href="' + catItem.getLink() + '" target="_blank">' + catItem.getDisplayValue() + ' ' + catItem.getClassDisplayValue() + '</a>';
} else if (!gs.nil(variables.variable_set)) {
var varSet = variables.variable_set.getRefRecord();
warningMessage = '<a href="' + varSet.getLink() + '" target="_blank">' + varSet.getDisplayValue() + ' variable set</a>';
}
warningMessage = warningMessage + " contains variables mapped to custom fields that may need to be added to your update set.";
if (warningMessages.indexOf(warningMessage) == -1) {
warningMessages.push(warningMessage);
}
}
variableList.push(variables.getValue("sys_id"));
}
this.clientSession.putClientData("warningMessages", warningMessages.toString());
var questionChoice = new GlideRecord("question_choice");
questionChoice.addQuery("question", "IN", variableList.toString());
questionChoice.query();
while (questionChoice.next()) {
this.saveRecord(questionChoice);
}
var clientScript = new GlideRecord("catalog_script_client");
clientScript.addEncodedQuery(itemQuery);
clientScript.query();
while (clientScript.next()) {
this.saveRecord(clientScript);
}
var uiPolicyList = [];
var uiPolicyQuery = itemQuery.replace("cat_item=", "catalog_item=");
var uiPolicy = new GlideRecord("catalog_ui_policy");
uiPolicy.addEncodedQuery(uiPolicyQuery);
uiPolicy.query();
while (uiPolicy.next()) {
this.saveRecord(uiPolicy);
uiPolicyList.push(uiPolicy.getUniqueValue());
}
var uiPolicyAction = new GlideRecord("catalog_ui_policy_action");
uiPolicyAction.addQuery("ui_policy", "IN", uiPolicyList.toString());
uiPolicyAction.query();
while (uiPolicyAction.next()) {
this.saveRecord(uiPolicyAction);
}
},
_addUserCriteria: function(availableForList, notAvailableForList) {
var arrayUtil = new global.ArrayUtil();
var userCriteriaList = arrayUtil.concat(availableForList, notAvailableForList);
var userCriteria = new GlideRecord("user_criteria");
userCriteria.addQuery("sys_id", "IN", userCriteriaList.toString());
userCriteria.query();
while (userCriteria.next()) {
this.saveRecord(userCriteria);
}
try {
// Check for linked HR Criteria
new sn_hr_core.addToUpdateSetUtils()._addHRCriteria("related_user_criteria", userCriteriaList.toString());
} catch (err) {
}
},
_addTemplate: function(templateID) {
var template = new GlideRecord("sys_template");
if (template.get(templateID)) {
this.saveRecord(template);
}
},
/********************* End Catalog & Workflow Functions *********************/
/********************* Begin Reporting and PA Functions *********************/
//Add PA Dashboard and all contents to the update set
_addPADashboard: function(tableRec, tableName) {
this.saveRecord(tableRec);
var dashboardID = tableRec.getValue("sys_id");
var groupID = tableRec.getValue("group");
if (!gs.nil(groupID)) {
var dashboardGroup = tableRec.group.getRefRecord();
this.saveRecord(dashboardGroup);
}
var breakdownSourceM2M = new GlideRecord("pa_m2m_dashboard_sources");
breakdownSourceM2M.addQuery("dashboard", dashboardID);
breakdownSourceM2M.query();
while (breakdownSourceM2M.next()) {
this.saveRecord(breakdownSourceM2M);
// Add Filter
var actAsFilter = breakdownSourceM2M.getValue("publisher");
if (!gs.nil(actAsFilter)) {
this._addInteractiveFilter(actAsFilter);
}
//Add report source
var breakdownSource = breakdownSourceM2M.getValue("breakdown_source");
if (!gs.nil(breakdownSource)) {
this._addPABreakdownSource(breakdownSource);
}
}
var dashboardPermission = new GlideRecord("pa_dashboards_permissions");
dashboardPermission.addQuery("dashboard", dashboardID);
dashboardPermission.query();
while (dashboardPermission.next()) {
this.saveRecord(dashboardPermission);
}
var portalPageList = [];
var dashboardTabM2M = new GlideRecord("pa_m2m_dashboard_tabs");
dashboardTabM2M.addQuery("dashboard", dashboardID);
dashboardTabM2M.query();
while (dashboardTabM2M.next()) {
this.saveRecord(dashboardTabM2M);
var dashboardTab = dashboardTabM2M.tab.getRefRecord();
this.saveRecord(dashboardTab);
var portalPageID = dashboardTab.getValue("page");
if (!gs.nil(portalPageID)) {
portalPageList.push(dashboardTab.getValue("page"));
}
var canvasPageID = dashboardTab.getValue("canvas_page");
if (!gs.nil(canvasPageID)) {
var canvasPage = dashboardTab.canvas_page.getRefRecord();
this.saveRecord(canvasPage);
if (!gs.nil(canvasPage.getValue("legacy_page"))) {
portalPageList.push(canvasPage.getValue("legacy_page"));
}
var canvasPane = new GlideRecord("sys_grid_canvas_pane");
canvasPane.addQuery("grid_canvas", canvasPageID);
canvasPane.query();
while (canvasPane.next()) {
this.saveRecord(canvasPane);
var pageID;
if (!gs.nil(canvasPane.getValue("portal_widget"))) {
pageID = canvasPane.portal_widget.page.toString();
if (!gs.nil(pageID)) {
portalPageList.push(pageID);
}
}
}
}
}
var portalPage = new GlideRecord("sys_portal_page");
portalPage.addQuery("sys_id", "IN", portalPageList.toString());
portalPage.query();
while (portalPage.next()) {
this._addPortalPage(portalPage);
}
},
//Add Homepage and all contents to the update set
_addPortalPage: function(portalPage, tableName) {
// Since unloader drops a bunch of files, check the update set scope before calling unloader
this._checkSetScope(portalPage);
GlideappHome.unloader(portalPage);
//Gather dropzones and contents for a homepage
this._addSysPortal(portalPage.getValue("sys_id"));
},
//Gather dropzones and contents for a homepage
_addSysPortal: function(portalID) {
var sysPortal = new GlideRecord("sys_portal");
sysPortal.addQuery("page", portalID);
sysPortal.query();
while (sysPortal.next()) {
var recID = sysPortal.getValue("sys_id");
// Because of cross references track the sys_portal records added and return if it has already been added
if (gs.nil(this.PAData)) {
this.PAData = {};
this.PAData.sysPortalIDs = [];
this.PAData.indicatorIDs = [];
this.PAData.breakdownIDs = [];
}
if (this.PAData.sysPortalIDs.indexOf(recID) == -1) {
this.PAData.sysPortalIDs.push(recID);
} else {
return;
}
this.saveRecord(sysPortal);
var portalPreferenceObject = {};
var portalPreference = new GlideRecord("sys_portal_preferences");
portalPreference.addQuery("portal_section", recID);
portalPreference.query();
while (portalPreference.next()) {
//this.saveRecord(portalPreference); //automatically added by GlideappHome.unloader(portalPage);
portalPreferenceObject[portalPreference.getValue("name")] = portalPreference.getValue("value");
}
// Add renderer components, other renderers can also be added
if (!gs.nil(portalPreferenceObject.renderer) && !gs.nil(portalPreferenceObject.sys_id)) {
switch (portalPreferenceObject.renderer.toString()) {
case "com.glide.ui.portal.RenderReport":
this._addReport(portalPreferenceObject.sys_id);
break;
case "com.snc.pa.ui.RenderPerformanceAnalytics":
this._addPAWidget(portalPreferenceObject.sys_id);
break;
case "com.glide.ui.portal.RenderDashboard":
this._addHPGauge(portalPreferenceObject.sys_id);
break;
case "com.glide.cms.RenderBlock":
this._addHPStaticContent(portalPreferenceObject.sys_id);
break;
}
}
}
},
//Add Report and contents to the update set
_addReport: function(sysReport, tableName) {
var recID;
if (typeof sysReport == "string") {
recID = sysReport;
tableName = gs.nil(tableName) ? "sys_report" : tableName;
sysReport = new GlideRecord(tableName);
sysReport.get(recID);
}
recID = sysReport.getValue("sys_id");
//Out of the box there are some orphaned report maps, validate it and if it is not valid, blank it out
var reportMap = new GlideRecord("sys_report_map");
if (!reportMap.get(sysReport.getValue("map"))) {
sysReport.map = "";
} else {
//Add map source
var mapSource = new GlideRecord("sys_report_map_source");
if (mapSource.get(sysReport.getValue("map_source"))) {
this.saveRecord(mapSource);
}
}
this.saveRecord(sysReport);
//Add report colors
this._addReportColors(sysReport);
//Add report color scheme
var reportColorScheme = new GlideRecord("pa_chart_color_schemes");
if (reportColorScheme.get(sysReport.getValue("color_pallete"))) {
this.saveRecord(reportColorScheme);
}
//Add report chart colors
this._addReportChartColors(sysReport);
//Add report source
var reportSourceIDs = [];
var reportSourceID = sysReport.getValue("report_source");
if (!gs.nil(reportSourceID)) {
reportSourceIDs.push(reportSourceID);
}
//Add report layers / datasets
var reportLayer = new GlideRecord("sys_report_layer");
reportLayer.addQuery("report", recID);
reportLayer.query();
while (reportLayer.next()) {
this.saveRecord(reportLayer);
reportSourceID = reportLayer.getValue("report_source");
if (!gs.nil(reportSourceID)) {
reportSourceIDs.push(reportSourceID);
}
}
//Add report source
var reportSource = new GlideRecord("sys_report_source");
reportSource.addQuery("sys_id", "IN", reportSourceIDs.toString());
reportSource.query();
while (reportSource.next()) {
this.saveRecord(reportSource);
}
//Add report header footer template
var reportHeaderFooter = new GlideRecord("sys_report_page_hdrftr");
if (reportHeaderFooter.get(sysReport.getValue("page_hdrftr"))) {
this.saveRecord(reportHeaderFooter);
}
//Add report drilldown
var reportDrillID = sysReport.getValue("report_drilldown");
if (!gs.nil(reportDrillID)) {
this._addReport(reportDrillID, "sys_report_drill");
}
//Add report users/groups
var reportUsersGroups = new GlideRecord("sys_report_users_groups");
reportUsersGroups.addQuery("report_id", recID);
reportUsersGroups.query();
while (reportUsersGroups.next()) {
this.saveRecord(reportUsersGroups);
}
//Add email report schedules
var sysautoReport = new GlideRecord("sysauto_report");
sysautoReport.addQuery("report", recID);
sysautoReport.query();
while (sysautoReport.next()) {
this.saveRecord(sysautoReport);
}
//Add multilevel pivot rules
var multilevelPivotRule = new GlideRecord("sys_report_mpivot_rule");
multilevelPivotRule.addQuery("report_id", recID);
multilevelPivotRule.query();
while (multilevelPivotRule.next()) {
this.saveRecord(multilevelPivotRule);
}
},
_addPAWidget: function(paWidget, tableName) {
var recID;
if (typeof paWidget == "string") {
recID = paWidget;
paWidget = new GlideRecord("pa_widgets");
paWidget.get(recID);
}
recID = paWidget.getValue("sys_id");
this.saveRecord(paWidget);
var fieldName;
//Add Indicators
var indicatorID = paWidget.getValue("indicator");
if (!gs.nil(indicatorID)) {
this._addPAIndicator(indicatorID);
}
var indicatorGroupID = paWidget.getValue("tag");
if (!gs.nil(indicatorGroupID)) {
this._addPAIndicatorGroup(indicatorGroupID);
}
//Add Breakdowns
var breakdownFieldList = ["breakdown", "breakdown_level2", "followed_breakdown", "pivot_breakdown"];
for (var b = 0; b < breakdownFieldList.length; b++) {
fieldName = breakdownFieldList[b];
if (paWidget.isValidField(fieldName) && !gs.nil(paWidget.getValue(fieldName))) {
this._addPABreakdown(paWidget.getValue(fieldName));
}
}
//Add report colors
this._addReportColors(paWidget);
//Add element filter
var filterFieldList = ["elements_filter", "pivot_elements_filter"];
for (var f = 0; f < filterFieldList.length; f++) {
fieldName = filterFieldList[f];
if (paWidget.isValidField(fieldName) && !gs.nil(paWidget.getValue(fieldName))) {
this._addPAFilter(paWidget.getValue(fieldName));
}
}
var widgetIndicator = new GlideRecord("pa_widget_indicators");
widgetIndicator.addQuery("widget", recID);
widgetIndicator.query();
while (widgetIndicator.next()) {
this.saveRecord(widgetIndicator);
indicatorID = widgetIndicator.getValue("indicator");
if (!gs.nil(indicatorID)) {
this._addPAIndicator(indicatorID);
}
//Add Breakdowns
breakdownFieldList = ["breakdown", "breakdown_level2", "followed_breakdown"];
for (var bI = 0; bI < breakdownFieldList.length; bI++) {
fieldName = breakdownFieldList[bI];
if (widgetIndicator.isValidField(fieldName) && !gs.nil(widgetIndicator.getValue(fieldName))) {
this._addPABreakdown(widgetIndicator.getValue(fieldName));
}
}
if (widgetIndicator.isValidField("color") && !gs.nil(widgetIndicator.getValue("color"))) {
reportColor = new GlideRecord("sys_report_color");
if (reportColor.get(widgetIndicator.getValue("color"))) {
this.saveRecord(reportColor);
}
}
if (widgetIndicator.isValidField("elements_filter") && !gs.nil(widgetIndicator.getValue("elements_filter"))) {
this._addPAFilter(widgetIndicator.getValue("elements_filter"));
}
}
var onClickBehavior = new GlideRecord("widget_navigation");
onClickBehavior.addQuery("widget", recID);
onClickBehavior.query();
while (onClickBehavior.next()) {
this.saveRecord(onClickBehavior);
}
},
_addPAIndicatorGroup: function(indicatorGroup, tableName) {
var recID;
if (typeof indicatorGroup == "string") {
recID = indicatorGroup;
indicatorGroup = new GlideRecord("pa_tags");
indicatorGroup.get(recID);
}
recID = indicatorGroup.getValue("sys_id");
this.saveRecord(indicatorGroup);
var indicatorGroupM2M = new GlideRecord("pa_m2m_indicator_tags");
indicatorGroupM2M.addQuery("tag", recID);
indicatorGroupM2M.query();
while (indicatorGroupM2M.next()) {
this.saveRecord(indicatorGroupM2M);
this._addPAIndicator(indicatorGroupM2M.getValue("indicator"));
}
},
_addPAIndicatorSource: function(indicatorSource, tableName) {
var recID;
if (typeof indicatorSource == "string") {
recID = indicatorSource;
indicatorSource = new GlideRecord("pa_cubes");
indicatorSource.get(recID);
}
recID = indicatorSource.getValue("sys_id");
this.saveRecord(indicatorSource);
var reportSource = new GlideRecord("sys_report_source");
if (reportSource.get(indicatorSource.getValue("report_source"))) {
this.saveRecord(reportSource);
}
var indicator = new GlideRecord("pa_indicators");
indicator.addQuery("cube", recID);
indicator.query();
while (indicator.next()) {
this._addPAIndicator(indicator);
}
var textIndexConfig = new GlideRecord("pa_text_index_configurations");
textIndexConfig.addQuery("cube", recID);
textIndexConfig.query();
while (textIndexConfig.next()) {
this.saveRecord(textIndexConfig);
}
},
_addPAIndicator: function(indicator, tableName) {
var recID;
if (typeof indicator == "string") {
recID = indicator;
indicator = new GlideRecord("pa_indicators");
indicator.get(recID);
}
if (!indicator.isValidRecord()) {
return;
}
recID = indicator.getValue("sys_id");
// Because of cross references track the pa_indicators records added and return if it has already been added
if (gs.nil(this.PAData)) {
this.PAData = {};
this.PAData.sysPortalIDs = [];
this.PAData.indicatorIDs = [];
this.PAData.breakdownIDs = [];
}
if (this.PAData.indicatorIDs.indexOf(recID) == -1) {
this.PAData.indicatorIDs.push(recID);
} else {
return;
}
this.saveRecord(indicator);
var indicatorSourceID = indicator.getValue("cube");
if (!gs.nil(indicatorSourceID)) {
var indicatorSource = new GlideRecord("pa_cubes");
if (indicatorSource.get(indicatorSourceID)) {
this.saveRecord(indicatorSource);
}
}
var unitID = indicator.getValue("unit");
if (!gs.nil(unitID)) {
var unit = new GlideRecord("pa_units");
if (unit.get(unitID)) {
this.saveRecord(unit);
}
}
var linkedIndicatorID = indicator.getValue("linked_indicator");
if (!gs.nil(linkedIndicatorID)) {
this._addPAIndicator(linkedIndicator);
}
var managingIndicatorID = indicator.getValue("managing_indicator");
if (!gs.nil(managingIndicatorID)) {
this._addPAIndicator(managingIndicator);
}
var paScriptID = indicator.getValue("script");
if (!gs.nil(paScriptID)) {
this._addPAScript(paScriptID);
}
var paIndicatorBreakdown = new GlideRecord("pa_indicator_breakdowns");
paIndicatorBreakdown.addQuery("indicator", recID);
paIndicatorBreakdown.query();
while (paIndicatorBreakdown.next()) {
this.saveRecord(paIndicatorBreakdown);
this._addPABreakdown(paIndicatorBreakdown.getValue("breakdown"));
}
this._addPATarget("indicator=" + recID);
this._addPAThreshold("indicator=" + recID);
var jobIndicator = new GlideRecord("pa_job_indicators");
jobIndicator.addQuery("indicator", recID);
jobIndicator.query();
while (jobIndicator.next()) {
this.saveRecord(jobIndicator);
var paJob = new GlideRecord("sysauto_pa");
if (paJob.get(jobIndicator.getValue("job"))) {
this.saveRecord(paJob);
}
var jobIndicatorBreakdownExclusion = new GlideRecord("pa_job_indicator_breakdown_ex");
jobIndicatorBreakdownExclusion.addQuery("job_indicator", jobIndicator.getValue("sys_id"));
jobIndicatorBreakdownExclusion.query();
while (jobIndicatorBreakdownExclusion.next()) {
this.saveRecord(jobIndicatorBreakdownExclusion);
}
}
var textIndexConfigM2M = new GlideRecord("pa_m2m_indicator_text_indexes");
textIndexConfigM2M.addQuery("indicator", recID);
textIndexConfigM2M.query();
while (textIndexConfigM2M.next()) {
this.saveRecord(textIndexConfigM2M);
var textIndexConfig = new GlideRecord("pa_text_index_configurations");
if (textIndexConfig.get(textIndexConfigM2M.getValue("text_index_configuration"))) {
this.saveRecord(textIndexConfig);
}
}
},
_addPABreakdownSource: function(breakdownSource, tableName) {
var recID;
if (typeof breakdownSource == "string") {
recID = breakdownSource;
breakdownSource = new GlideRecord("pa_dimensions");
breakdownSource.get(recID);
}
recID = breakdownSource.getValue("sys_id");
this.saveRecord(breakdownSource);
//Check of facts table is Bucket (pa_buckets) and add those records if so
if (breakdownSource.getValue("facts_table") == "pa_buckets") {
var templateObject = this.parseTemplateString(breakdownSource.getValue('conditions'));
var bucketGroupID = templateObject.bucket_group;
if (!gs.nil(bucketGroupID)) {
var bucketGroup = new GlideRecord("pa_bucket_groups");
if (bucketGroup.get(bucketGroupID)) {
this.saveRecord(bucketGroup);
var bucket = new GlideRecord("pa_buckets");
bucket.addQuery("bucket_group", bucketGroupID);
bucket.query();
while (bucket.next()) {
this.saveRecord(bucket);
}
}
}
}
var paBreakdown = new GlideRecord("pa_breakdowns");
paBreakdown.addQuery("dimension", recID);
paBreakdown.query();
while (paBreakdown.next()) {
this._addPABreakdown(paBreakdown);
}
},
_addPABreakdown: function(paBreakdown, tableName) {
var recID;
if (typeof paBreakdown == "string") {
recID = paBreakdown;
paBreakdown = new GlideRecord("pa_breakdowns");
paBreakdown.get(recID);
}
recID = paBreakdown.getValue("sys_id");
// Because of cross references track the pa_breakdowns records added and return if it has already been added
if (gs.nil(this.PAData)) {
this.PAData = {};
this.PAData.sysPortalIDs = [];
this.PAData.indicatorIDs = [];
this.PAData.breakdownIDs = [];
}
if (this.PAData.breakdownIDs.indexOf(recID) == -1) {
this.PAData.breakdownIDs.push(recID);
} else {
return;
}
this.saveRecord(paBreakdown);
var breakdownSourceID = paBreakdown.getValue("dimension");
if (!gs.nil(breakdownSourceID)) {
var breakdownSource = new GlideRecord("pa_dimensions");
if (breakdownSource.get(breakdownSourceID)) {
this.saveRecord(breakdownSource);
}
}
var elementsFilterID = paBreakdown.getValue("default_filter");
if (!gs.nil(elementsFilterID)) {
this._addPAFilter(elementsFilterID);
}
var paScriptID = paBreakdown.getValue("script");
if (!gs.nil(paScriptID)) {
this._addPAScript(paScriptID);
}
var manualBreakdowns = new GlideRecord("pa_manual_breakdowns");
manualBreakdowns.addQuery("breakdown", recID);
manualBreakdowns.query();
while (manualBreakdowns.next()) {
this.saveRecord(manualBreakdowns);
}
this._addPATarget("breakdown=" + recID + "^ORbreakdown_level2=" + recID);
this._addPAThreshold("breakdown=" + recID + "^ORbreakdown_level2=" + recID);
var breakdownMapping = new GlideRecord("pa_breakdown_mappings");
breakdownMapping.addQuery("breakdown", recID);
breakdownMapping.query();
while (breakdownMapping.next()) {
this.saveRecord(breakdownMapping);
paScriptID = breakdownMapping.getValue("script");
if (!gs.nil(paScriptID)) {
this._addPAScript(paScriptID);
}
}
var breakdownRelation = new GlideRecord("pa_breakdown_relations");
breakdownRelation.addQuery("breakdown", recID);
breakdownRelation.query();
while (breakdownRelation.next()) {
this.saveRecord(breakdownRelation);
var relatedBreakdownID = breakdownRelation.getValue("related_breakdown");
if (!gs.nil(relatedBreakdownID)) {
this._addPABreakdown(relatedBreakdownID);
}
}
},
_addPATarget: function(targetQuery) {
var paTarget = new GlideRecord("pa_targets");
paTarget.addEncodedQuery(targetQuery);
paTarget.query();
while (paTarget.next()) {
this.saveRecord(paTarget);
if (targetQuery.startsWith("indicator")) {
if (!gs.nil(paTarget.getValue("breakdown"))) {
this._addPABreakdown(paTarget.getValue("breakdown"));
}
if (!gs.nil(paTarget.getValue("breakdown_level2"))) {
this._addPABreakdown(paTarget.getValue("breakdown_level2"));
}
} else if (!gs.nil(paTarget.getValue("indicator"))) {
this._addPAIndicator(paTarget.getValue("indicator"));
}
var targetValue = new GlideRecord("pa_target_values");
targetValue.addQuery("target", paTarget.getValue("sys_id"));
targetValue.query();
while (targetValue.next()) {
this.saveRecord(targetValue);
}
}
},
_addPAThreshold: function(thresholdQuery) {
var paThreshold = new GlideRecord("pa_thresholds");
paThreshold.addEncodedQuery(thresholdQuery);
paThreshold.query();
while (paThreshold.next()) {
this.saveRecord(paThreshold);
if (thresholdQuery.startsWith("indicator")) {
if (!gs.nil(paThreshold.getValue("breakdown"))) {
this._addPABreakdown(paThreshold.getValue("breakdown"));
}
if (!gs.nil(paThreshold.getValue("breakdown_level2"))) {
this._addPABreakdown(paThreshold.getValue("breakdown_level2"));
}
} else if (!gs.nil(paThreshold.getValue("indicator"))) {
this._addPAIndicator(paThreshold.getValue("indicator"));
}
}
},
_addPAScript: function(paScriptID) {
var paScript = new GlideRecord("pa_scripts");
if (paScript.get(paScriptID)) {
this.saveRecord(paScript);
}
},
_addPAFilter: function(paFilterID) {
var elementsFilter = new GlideRecord("pa_filters");
if (elementsFilter.get(paFilterID)) {
this.saveRecord(elementsFilter);
}
},
//Add report colors
_addReportColors: function(record) {
var colorList = [];
var exclusionFields = [];
var recordUtil = new GlideRecordUtil();
var fieldList = recordUtil.getFields(record);
for (var i = 0; i < fieldList.length; i++) {
var fieldName = fieldList[i];
var fieldType = record.getElement(fieldName).getED().getInternalType();
if (fieldType != "reference" || exclusionFields.indexOf(fieldName) > -1 || record[fieldName].getReferenceTable() != "sys_report_color") {
continue;
}
var fieldValue = record.getValue(fieldName);
if (!gs.nil(fieldValue) && colorList.indexOf(colorList) == -1) {
colorList.push(fieldValue);
}
}
var reportColor = new GlideRecord("sys_report_color");
reportColor.addQuery("sys_id", "IN", colorList.toString());
reportColor.query();
while (reportColor.next()) {
this.saveRecord(reportColor);
}
},
//Add report chart colors
_addReportChartColors: function(record) {
if (record.getValue('set_color') == 'chart_colors') {
var encQuery = "name=" + record.getValue('table') + "^element=" + record.getValue('field');
var chartColor = new GlideRecord('sys_report_chart_color');
chartColor.addEncodedQuery(encQuery);
chartColor.query();
while (chartColor.next()) {
this.saveRecord(chartColor);
}
}
},
//Add interactive filter
_addInteractiveFilter: function(record, tableName) {
var recID;
if (typeof record == "string") {
recID = record;
record = new GlideRecord("sys_ui_hp_publisher");
record.get(recID);
}
recID = record.getValue("sys_id");
this.saveRecord(record);
//Add cascading filter
var cascadingFilter = new GlideRecord("sys_ui_hp_cascading_filter");
cascadingFilter.addQuery("publisher_reference", recID);
cascadingFilter.query();
while (cascadingFilter.next()) {
this._addCascadingFilter(cascadingFilter);
}
//Add choice lists - may revisit later as the Exclusion and Default value fields point to sys_choice and no ability to add new ones
//Add filter reference
var filterRef = new GlideRecord("sys_ui_hp_reference");
filterRef.addQuery("publisher_reference", recID);
filterRef.query();
while (filterRef.next()) {
this.saveRecord(filterRef);
}
//Add filter date
var filterDate = new GlideRecord("sys_ui_hp_date");
filterDate.addQuery("publisher_reference", recID);
filterDate.query();
while (filterDate.next()) {
this.saveRecord(filterDate);
}
//Add group & child filters
var filterGroup = new GlideRecord("sys_ui_hp_group");
filterGroup.addQuery("group_publisher", recID);
filterGroup.query();
while (filterGroup.next()) {
this.saveRecord(filterGroup);
var childFilter = new GlideRecord("sys_ui_hp_publisher");
if (childFilter.get(filterGroup.getValue('child_publisher'))) {
this._addInteractiveFilter(childFilter, childFilter.getTableName());
}
}
},
_addCascadingFilter: function(record, tableName) {
var recID;
if (typeof record == "string") {
recID = record;
record = new GlideRecord("sys_ui_hp_cascading_filter");
record.get(recID);
}
recID = record.getValue("sys_id");
this.saveRecord(record);
//Add cascading filter
var cascadingFilter = new GlideRecord("sys_ui_hp_cascading_filter");
cascadingFilter.addQuery("parent", recID);
cascadingFilter.query();
while (cascadingFilter.next()) {
this._addCascadingFilter(cascadingFilter);
}
},
//Add Home Page Static Content to the update set
_addHPStaticContent: function(staticContentID) {
var staticContent = new GlideRecord("content_block_static");
if (staticContent.get(staticContentID)) {
this.saveRecord(staticContent);
}
},
//Add Home Page Gauge and contents to the update set
_addHPGauge: function(sysGaugeID) {
var sysGauge = new GlideRecord("sys_gauge");
if (sysGauge.get(sysGaugeID)) {
this.saveRecord(sysGauge);
if (sysGauge.getValue("type") == "report") {
this._addReport(sysGauge.getValue("report"));
}
}
},
/********************* End Reporting and PA Functions *********************/
//Add assessment to the update set
_addAssessment: function(tableRec, tableName) {
this.saveRecord(tableRec);
// Check for auto-generated business rules
var businessRuleIDs = [];
var businessRuleID = tableRec.getValue("business_rule");
if (!gs.nil(businessRuleID)) {
businessRuleIDs.push(businessRuleID);
}
businessRuleID = tableRec.getValue("delete_business_rule");
if (!gs.nil(businessRuleID)) {
businessRuleIDs.push(businessRuleID);
}
var businessRule = new GlideRecord("sys_script");
businessRule.addQuery("sys_id", "IN", businessRuleIDs.toString());
businessRule.query();
while (businessRule.next()) {
this.saveRecord(businessRule);
}
var assessmentID = tableRec.getValue("sys_id");
var assessmentCategory = new GlideRecord("asmt_metric_category");
assessmentCategory.addQuery("metric_type", assessmentID);
assessmentCategory.query();
while (assessmentCategory.next()) {
this.saveRecord(assessmentCategory);
var assessmentQuestion = new GlideRecord("asmt_metric");
assessmentQuestion.addQuery("category", assessmentCategory.getValue("sys_id"));
assessmentQuestion.query();
while (assessmentQuestion.next()) {
this.saveRecord(assessmentQuestion);
var assessmentQuestionID = assessmentQuestion.getValue("sys_id");
var assessmentTemplate = assessmentQuestion.template.getRefRecord();
this.saveRecord(assessmentTemplate);
var assessmentTemplateDefinition = new GlideRecord("asmt_template_definition");
assessmentTemplateDefinition.addQuery("template", assessmentQuestionID);
assessmentTemplateDefinition.query();
while (assessmentTemplateDefinition.next()) {
this.saveRecord(assessmentTemplateDefinition);
}
var assessmentDefinition = new GlideRecord("asmt_metric_definition");
assessmentDefinition.addQuery();
assessmentDefinition.query("metric", assessmentQuestionID);
while (assessmentDefinition.next()) {
this.saveRecord(assessmentDefinition);
}
}
}
var assessmentCondition = new GlideRecord("asmt_condition");
assessmentCondition.addQuery("assessment", assessmentID);
assessmentCondition.query();
while (assessmentCondition.next()) {
this.saveRecord(assessmentCondition);
businessRule = assessmentCondition.business_rule.getRefRecord();
this.saveRecord(businessRule);
}
},
//Add Virtual Agent to the update set
_addVirtualAgent: function(tableRec, tableName) {
this.saveRecord(tableRec);
var otherTable = "";
var queryField = "";
var queryValue = "";
var csTopicID = "";
var cbTopicID = "";
if (tableName == "sys_cs_topic") {
csTopicID = tableRec.getValue("sys_id");
cbTopicID = tableRec.getValue("cb_topic_id");
otherTable = "sys_cb_topic";
queryField = "sys_id";
queryValue = cbTopicID;
} else {
cbTopicID = tableRec.getValue("sys_id");
otherTable = "sys_cs_topic";
queryField = "cb_topic_id";
queryValue = cbTopicID;
}
var agentTopic = new GlideRecord(otherTable);
agentTopic.addQuery(queryField, queryValue);
agentTopic.query();
if (agentTopic.next()) {
this.saveRecord(agentTopic);
} else {
agentTopic.initialize();
agentTopic.addQuery("name", tableRec.getValue("name"));
agentTopic.query();
if (agentTopic.next()) {
this.saveRecord(agentTopic);
}
}
if (csTopicID == "" && otherTable == "sys_cs_topic") {
csTopicID = agentTopic.getValue("sys_id");
}
//Add Design Topic
if (!gs.nil(csTopicID) && !gs.nil(cbTopicID)) {
var cbDesignTopic = new GlideRecord("sys_cb_design_topic");
cbDesignTopic.query("compiled_topic", csTopicID);
cbDesignTopic.query("design_topic_id", cbTopicID);
cbDesignTopic.query();
if (cbDesignTopic.next()) {
this.saveRecord(cbDesignTopic);
}
}
//Add Topic Variables
var topicVariable = new GlideRecord("topic_variable");
topicVariable.query("model", cbTopicID);
topicVariable.query();
while (topicVariable.next()) {
this.saveRecord(topicVariable);
}
//Add Field Labal
var sysDocumentation = new GlideRecord("sys_documentation");
sysDocumentation.addQuery("name", "CONTAINS", cbTopicID);
sysDocumentation.query();
while (sysDocumentation.next()) {
this.saveRecord(sysDocumentation);
}
//Add NLU Model if set
var hasNLUModel = false;
var nluModelID = "";
if (tableRec.isValidField("nlu_model")) {
nluModelID = tableRec.getValue("nlu_model");
if (!gs.nil(nluModelID)) {
hasNLUModel = true;
}
}
if (hasNLUModel) {
this._addNLUModel(nluModelID);
}
},
_addNLUModel: function(NLUModel, tableName) {
var recID;
if (typeof NLUModel == "string") {
recID = NLUModel;
NLUModel = new GlideRecord("sys_nlu_model");
if (!NLUModel.get("name", recID)) {
NLUModel.initialize();
}
}
// Check if NLU Model has Protection Policy set and if so, abort adding it since that should be part of Plugin or Store App
if (this.preventProtectedNLUModels && !gs.nil(NLUModel.getValue("sys_policy"))) {
var warningMessages = this.clientSession.getClientData("warningMessages") + "";
// split adding an extra comma so checking length
if (warningMessages.length == 0) {
warningMessages = [];
} else {
warningMessages = warningMessages.split(",");
}
var warningMessage = '<a href="' + NLUModel.getLink() + '" target="_blank">' + NLUModel.getDisplayValue() + '</a> ' + NLUModel.getClassDisplayValue();
warningMessage = warningMessage + " could not be added to the update set because of its protection policy.";
if (warningMessages.indexOf(warningMessage) == -1) {
warningMessages.push(warningMessage);
}
this.clientSession.putClientData("warningMessages", warningMessages.toString());
return;
}
this.saveRecord(NLUModel);
recID = NLUModel.getValue("sys_id");
var intentList = [];
var NLUIntent = new GlideRecord("sys_nlu_intent");
NLUIntent.addQuery("model", recID);
NLUIntent.query();
while (NLUIntent.next()) {
this.saveRecord(NLUIntent);
intentList.push(NLUIntent.getValue("sys_id"));
}
var NLUUtterance = new GlideRecord("sys_nlu_utterance");
NLUUtterance.addQuery("intent", "IN", intentList.toString());
NLUUtterance.query();
while (NLUUtterance.next()) {
this.saveRecord(NLUUtterance);
}
var entityList = [];
var intentEntityM2M = new GlideRecord("m2m_sys_nlu_intent_entity");
intentEntityM2M.addQuery("intent", "IN", intentList.toString());
intentEntityM2M.query();
while (intentEntityM2M.next()) {
this.saveRecord(intentEntityM2M);
entityList.push(intentEntityM2M.getValue("entity"));
}
var NLUEntity = new GlideRecord("sys_nlu_entity");
NLUEntity.addQuery("sys_id", "IN", entityList.toString()).addOrCondition("model", recID);
NLUEntity.query();
while (NLUEntity.next()) {
this.saveRecord(NLUEntity);
}
var NLUVocabulary = new GlideRecord("sys_nlu_vocabulary");
NLUVocabulary.addQuery("model", recID);
NLUVocabulary.query();
while (NLUVocabulary.next()) {
this.saveRecord(NLUVocabulary);
}
var systemEntityM2M = new GlideRecord("m2m_sys_nlu_model_sys_entity");
systemEntityM2M.addQuery("model", recID);
systemEntityM2M.query();
while (systemEntityM2M.next()) {
this.saveRecord(systemEntityM2M);
var systemEntity = new GlideRecord("sys_nlu_sys_entity");
systemEntity.addQuery("sys_id", systemEntityM2M.getValue("sys_entity"));
systemEntity.query();
while (systemEntity.next()) {
this.saveRecord(systemEntity);
}
}
/*
* When moving NLU models from one instance to another, they are loaded in unpublished even though they may have been published in the source instance.
* The below code will check the status of the NLU model in the source instance and if it is published it will add a scheduled job to the update set
* to automatically publish the model in the target instance.
*
* This solution is a two pronged approach because of the fact that when the instance is loading the update set, we cannot control the order in which the
* updates are loaded. This scheduled job will run soon after the update set is loaded but will create another scheduled job that will run 60 seconds
* after that to publish the NLU model. 60 seconds should be enough time to load the update set components but feel free to adjust the delaySeconds variable value.
*/
if (NLUModel.getValue("state") == "Published") {
var delaySeconds = 60;
var scheduledJobName = NLUModel.getValue("display_name") + ": Train and Publish";
var scheduledJobScript = [];
scheduledJobScript.push("var scheduledJob = new GlideRecord('sys_trigger');");
scheduledJobScript.push("scheduledJob.initialize();");
scheduledJobScript.push("scheduledJob.name = '" + scheduledJobName + "'");
scheduledJobScript.push("scheduledJob.trigger_type = 0");
scheduledJobScript.push("var nextAction = new GlideDateTime()");
scheduledJobScript.push("nextAction.addSeconds(" + delaySeconds + ")");
scheduledJobScript.push("scheduledJob.next_action = nextAction");
var targetScript = [];
targetScript.push("var nluID = '" + recID + "'");
targetScript.push("new global.NLUStudioUtil().trainModel(nluID)");
targetScript.push("new global.NLUStudioUtil().publishModel(nluID)");
targetScript = targetScript.join(";").replace(/'/g, "\\'");
scheduledJobScript.push("scheduledJob.script = '" + targetScript + ";'");
scheduledJobScript.push("scheduledJob.insert()");
var scheduleJobFields = {};
scheduleJobFields.name = scheduledJobName;
var nowDateTime = new GlideDateTime();
scheduleJobFields.next_action = nowDateTime.getDisplayValue();
scheduleJobFields.trigger_type = "0";
scheduleJobFields.script = scheduledJobScript.join(";") + ";";
this.addScheduledJob(scheduleJobFields);
}
},
_addManagedDoc: function(tableRec, tableName) {
this.saveRecord(tableRec);
var managedDocID = tableRec.getValue("sys_id");
var docRevision = new GlideRecord("dms_document_revision");
docRevision.addQuery("document", managedDocID);
docRevision.query();
while (docRevision.next()) {
this.saveRecord(docRevision);
// Check to ensure Human Resources Core plugin is active
if (new GlidePluginManager().isActive("com.sn_hr_core")) {
try {
//Add HR PDF Template
new sn_hr_core.addToUpdateSetUtils()._getHRDocumentTemplates(docRevision.getValue("sys_id"));
} catch (err) {
}
}
}
var userPermission = new GlideRecord("dms_document_user_permission");
userPermission.addQuery("document", managedDocID);
userPermission.query();
while (userPermission.next()) {
this.saveRecord(userPermission);
}
var groupPermission = new GlideRecord("dms_document_group_permission");
groupPermission.addQuery("document", managedDocID);
groupPermission.query();
while (groupPermission.next()) {
this.saveRecord(groupPermission);
}
var knowledgeRecordM2M = new GlideRecord("m2m_document_knowledge");
knowledgeRecordM2M.addQuery("document", managedDocID);
knowledgeRecordM2M.query();
while (knowledgeRecordM2M.next()) {
this.saveRecord(knowledgeRecordM2M);
var kbKnowledge = new GlideRecord("kb_knowledge");
if (kbKnowledge.get(knowledgeRecordM2M.getValue("knowledge"))) {
this._addKnowledge(kbKnowledge, knowledgeRecordM2M.getValue("knowledge_table_name"));
}
}
},
_addATFSuite: function(atfTestSuite, tableName) {
this.saveRecord(atfTestSuite);
var testSuiteID = atfTestSuite.getValue("sys_id");
//Add ATF Tests and dependencies
var testSuiteTest = new GlideRecord("sys_atf_test_suite_test");
testSuiteTest.addQuery("test_suite", testSuiteID);
testSuiteTest.query();
while (testSuiteTest.next()) {
var atfTest = new GlideRecord("sys_atf_test");
if (atfTest.get(testSuiteTest.getValue("test"))) {
this._addATF(atfTest, "sys_atf_test");
}
this.saveRecord(testSuiteTest);
}
//Add Child Test Suites
var childTestSuite = new GlideRecord("sys_atf_test_suite");
childTestSuite.addQuery("parent", testSuiteID);
childTestSuite.query();
while (childTestSuite.next()) {
this._addATFSuite(childTestSuite);
}
//Add Test Suite Schedule Run
var testSuiteSchedule = new GlideRecord("sys_atf_schedule_run");
testSuiteSchedule.addQuery("test_suite", testSuiteID);
testSuiteSchedule.query();
while (testSuiteSchedule.next()) {
//Add Test Suite Schedule Run's Schedule
var schedule = new GlideRecord("sys_atf_schedule");
if (schedule.get(testSuiteSchedule.getValue("schedule"))) {
this.saveRecord(schedule);
}
this.saveRecord(testSuiteSchedule);
}
},
_addATF: function(atfTest, tableName) {
this.saveRecord(atfTest);
var testID = atfTest.getValue("sys_id");
var stepConfigList = [];
var testStep = new GlideRecord("sys_atf_step");
testStep.addQuery("test", testID);
testStep.query();
while (testStep.next()) {
this.saveRecord(testStep);
//Check to see if linked test step config is protected and if not add it
if (gs.nil((testStep.step_config.sys_policy.toString()))) {
stepConfigList.push(testStep.getValue("step_config"));
}
}
if (stepConfigList.length > 0) {
var testStepConfig = new GlideRecord("sys_atf_step_config");
testStepConfig.addQuery("sys_id", "IN", stepConfigList.toString());
testStepConfig.query();
while (testStepConfig.next()) {
this.saveRecord(testStepConfig);
var testStepConfigID = testStepConfig.getValue("sys_id");
var inputVariable = new GlideRecord("atf_input_variable");
inputVariable.addQuery("model", testStepConfigID);
inputVariable.query();
while (inputVariable.next()) {
this.saveRecord(inputVariable);
}
var outputVariable = new GlideRecord("atf_output_variable");
outputVariable.addQuery("model", testStepConfigID);
outputVariable.query();
while (outputVariable.next()) {
this.saveRecord(outputVariable);
}
}
}
var testRunDataSet = new GlideRecord("sys_atf_parameter_set");
testRunDataSet.addQuery("test", testID);
testRunDataSet.query();
while (testRunDataSet.next()) {
this.saveRecord(testRunDataSet);
}
var dictionaryQuery = "name=sys_atf_parameter_set^element!=active^element!=description^element!=order^element!=parameters^element!=sys_id^element!=test^element!=copied_from";
var sysDictionary = new GlideRecord("sys_dictionary");
sysDictionary.addEncodedQuery(dictionaryQuery);
sysDictionary.query();
if (sysDictionary.hasNext()) {
while (sysDictionary.next()) {
this._addField(sysDictionary, "sys_dictionary");
}
// Add Test Run Data Set Form since it was modified when adding sys_dictionary records
var uiFormSection = new GlideRecord("sys_ui_section");
uiFormSection.addQuery("name", "sys_atf_parameter_set");
uiFormSection.query();
while (uiFormSection.next()) {
this.saveRecord(uiFormSection);
}
}
var parameterVariable = new GlideRecord("sys_atf_parameter_variable");
parameterVariable.addQuery("model", testID);
parameterVariable.query();
while (parameterVariable.next()) {
this._addField(parameterVariable, "sys_atf_parameter_variable");
}
},
//Add guided tour and dependencies to the update set
_addGuidedTour: function(tableRec, tableName) {
this.saveRecord(tableRec);
var recID = tableRec.getValue("sys_id");
var actionTargetRefList = [];
var guidedTourStep = new GlideRecord("sys_embedded_tour_step");
guidedTourStep.addQuery("guide", recID);
guidedTourStep.query();
while (guidedTourStep.next()) {
this.saveRecord(guidedTourStep);
var actionTargetRefID = guidedTourStep.getValue("action_target_ref");
if (!gs.nil(actionTargetRefID)) {
actionTargetRefList.push(actionTargetRefID);
}
}
if (actionTargetRefList.length > 0) {
var guidedTourElement = new GlideRecord("sys_embedded_tour_element");
guidedTourElement.addQuery("sys_id", "IN", actionTargetRefList.toString());
guidedTourElement.query();
while (guidedTourElement.next()) {
this.saveRecord(guidedTourElement);
}
}
},
/********************* Begin Service Portal Functions *********************/
_addSPPortal: function(record, tableName) {
this.saveRecord(record);
var portalPage;
//Add homepage
if (!record.homepage.nil()) {
portalPage = new GlideRecord("sp_page");
if (portalPage.get(record.getValue('homepage'))) {
this.saveRecord(portalPage);
this._addPageDependencies(portalPage);
}
}
//Add KB homepage
if (!record.kb_knowledge_page.nil()) {
portalPage = new GlideRecord("sp_page");
if (portalPage.get(record.getValue('kb_knowledge_page'))) {
this.saveRecord(portalPage);
this._addPageDependencies(portalPage);
}
}
//Add Login page
if (!record.login_page.nil()) {
portalPage = new GlideRecord("sp_page");
if (portalPage.get(record.getValue('login_page'))) {
this.saveRecord(portalPage);
this._addPageDependencies(portalPage);
}
}
//Add 404 page
if (!record.notfound_page.nil()) {
portalPage = new GlideRecord("sp_page");
if (portalPage.get(record.getValue('notfound_page'))) {
this.saveRecord(portalPage);
this._addPageDependencies(portalPage);
}
}
//Add Catalog page
if (!record.sc_catalog_page.nil()) {
portalPage = new GlideRecord("sp_page");
if (portalPage.get(record.getValue('sc_catalog_page'))) {
this.saveRecord(portalPage);
this._addPageDependencies(portalPage);
}
}
//Add Main Menu
if (!record.sp_rectangle_menu.nil()) {
var mainMenu = new GlideRecord("sp_instance_menu");
if (mainMenu.get(record.getValue('sp_rectangle_menu'))) {
//Add Menu rectangle items
var menuRectangleItem = new GlideRecord("sp_rectangle_menu_item");
menuRectangleItem.addQuery("sp_rectangle_menu", mainMenu.getUniqueValue());
menuRectangleItem.query();
while (menuRectangleItem.next()) {
this.saveRecord(menuRectangleItem);
this._gatherChildMenuRectangleItems(menuRectangleItem);
}
this.saveRecord(mainMenu);
}
}
//Add Theme
if (!record.theme.nil()) {
var theme = new GlideRecord("sp_theme");
if (theme.get(record.getValue('theme'))) {
//Add header & footer
var headerFooter = new GlideRecord("sp_header_footer");
headerFooter.addQuery("sys_id", theme.getValue('header')).addOrCondition("sys_id", theme.getValue('footer'));
headerFooter.query();
while (headerFooter.next()) {
//Add ng-templates
var ngTemplate = new GlideRecord("sp_ng_template");
ngTemplate.addQuery("sp_widget", headerFooter.getUniqueValue());
ngTemplate.query();
while (ngTemplate.next())
this.saveRecord(ngTemplate);
this.saveRecord(headerFooter);
}
//Add JS Includes
var jsIncludeM2M = new GlideRecord("m2m_sp_theme_js_include");
jsIncludeM2M.addQuery("sp_theme", theme.getUniqueValue());
jsIncludeM2M.query();
while (jsIncludeM2M.next()) {
var jsInclude = new GlideRecord("sp_js_include");
if (jsInclude.get(jsIncludeM2M.getValue('sp_js_include'))) {
//For local js includes, get ui script
if (jsInclude.getValue('source') == 'local') {
var uiScript = new GlideRecord("sys_ui_script");
if (uiScript.get(jsInclude.getValue('sys_ui_script')))
this.saveRecord(uiScript);
}
this.saveRecord(jsInclude);
}
this.saveRecord(jsIncludeM2M);
}
//Add CSS Includes
var cssIncludeM2M = new GlideRecord("m2m_sp_theme_css_include");
cssIncludeM2M.addQuery("sp_theme", theme.getUniqueValue());
cssIncludeM2M.query();
while (cssIncludeM2M.next()) {
var cssInclude = new GlideRecord("sp_css_include");
if (cssInclude.get(cssIncludeM2M.getValue('sp_css_include'))) {
//For local css includes, get style sheet
if (cssInclude.getValue('source') == 'local') {
var styleSheet = new GlideRecord("sp_css");
if (styleSheet.get(cssInclude.getValue('sp_css')))
this.saveRecord(styleSheet);
}
this.saveRecord(cssInclude);
}
this.saveRecord(cssIncludeM2M);
}
this.saveRecord(theme);
}
}
//Add Search Sources
var searchSourceList = [];
var searchSourceM2M = new GlideRecord("m2m_sp_portal_search_source");
searchSourceM2M.addQuery("sp_portal", record.getUniqueValue());
searchSourceM2M.query();
while (searchSourceM2M.next()) {
this.saveRecord(searchSourceM2M);
searchSourceList.push(searchSourceM2M.getValue('sp_search_source'));
}
if (searchSourceList.length > 0)
this._addSearchSources(searchSourceList);
},
_addSearchSources: function(recordIDs) {
var searchSource = new GlideRecord("sp_search_source");
searchSource.addQuery("sys_id", "IN", recordIDs.toString());
searchSource.query();
while (searchSource.next()) {
this.saveRecord(searchSource);
}
},
_addSPWidget: function(record, tableName) {
this.saveRecord(record);
this._addWidgetDependencies(record);
},
_addSPPage: function(record, tableName) {
this.saveRecord(record);
this._addPageDependencies(record);
},
//Add page dependencies to the update set
_addPageDependencies: function(record) {
//Add containers
var container = new GlideRecord("sp_container");
container.addQuery("sp_page", record.getUniqueValue());
container.query();
while (container.next()) {
//Add rows
var row = new GlideRecord("sp_row");
row.addQuery("sp_container", container.getUniqueValue());
row.query();
while (row.next()) {
//add columns and column rows and widget instances
this._gatherColumnsAndColumnRowsAndInstances(row);
this.saveRecord(row);
}
this.saveRecord(container);
}
//Add menu rectangle items
var menuRectangleItem = new GlideRecord("sp_rectangle_menu_item");
menuRectangleItem.addQuery("sp_page", record.getUniqueValue());
menuRectangleItem.query();
while (menuRectangleItem.next()) {
this.saveRecord(menuRectangleItem);
this._gatherChildMenuRectangleItems(menuRectangleItem);
}
this._gatherSPUserCriteria("sp_page", record.getUniqueValue());
try {
//Add content delivery items
new sn_cd.addToUpdateSetUtils().checkScheduledContent(record.getUniqueValue());
} catch (err) {
}
},
//Add widget dependencies to the update set
_addWidgetDependencies: function(record) {
//Add dependencies
var dependencyM2M = new GlideRecord("m2m_sp_widget_dependency");
dependencyM2M.addQuery("sp_widget", record.getUniqueValue());
dependencyM2M.query();
while (dependencyM2M.next()) {
var dependency = new GlideRecord("sp_dependency");
if (dependency.get(dependencyM2M.getValue('sp_dependency'))) {
//Add JS Includes
var jsIncludeM2M = new GlideRecord("m2m_sp_dependency_js_include");
jsIncludeM2M.addQuery("sp_dependency", dependency.getUniqueValue());
jsIncludeM2M.query();
while (jsIncludeM2M.next()) {
var jsInclude = new GlideRecord("sp_js_include");
if (jsInclude.get(jsIncludeM2M.getValue('sp_js_include'))) {
//For local js includes, get ui script
if (jsInclude.getValue('source') == 'local') {
var uiScript = new GlideRecord("sys_ui_script");
if (uiScript.get(jsInclude.getValue('sys_ui_script')))
this.saveRecord(uiScript);
}
this.saveRecord(jsInclude);
}
this.saveRecord(jsIncludeM2M);
}
//Add CSS Includes
var cssIncludeM2M = new GlideRecord("m2m_sp_dependency_css_include");
cssIncludeM2M.addQuery("sp_dependency", dependency.getUniqueValue());
cssIncludeM2M.query();
while (cssIncludeM2M.next()) {
var cssInclude = new GlideRecord("sp_css_include");
if (cssInclude.get(cssIncludeM2M.getValue('sp_css_include'))) {
//For local css includes, get style sheet
if (cssInclude.getValue('source') == 'local') {
var styleSheet = new GlideRecord("sp_css");
if (styleSheet.get(cssInclude.getValue('sp_css')))
this.saveRecord(styleSheet);
}
this.saveRecord(cssInclude);
}
this.saveRecord(cssIncludeM2M);
}
this.saveRecord(dependency);
}
this.saveRecord(dependencyM2M);
}
//Add angular providers
var providerM2M = new GlideRecord("m2m_sp_ng_pro_sp_widget");
providerM2M.addQuery("sp_widget", record.getUniqueValue());
providerM2M.query();
while (providerM2M.next()) {
var provider = new GlideRecord("sp_angular_provider");
if (provider.get(providerM2M.getValue('sp_angular_provider'))) {
//Get required providers
this._gatherRequiredProviders(provider);
this._addAngularProvider(provider, provider.getTableName());
}
this.saveRecord(providerM2M);
}
//Add ng-templates
var ngTemplate = new GlideRecord("sp_ng_template");
ngTemplate.addQuery("sp_widget", record.getUniqueValue());
ngTemplate.query();
while (ngTemplate.next()) {
this._addNgTemplate(ngTemplate, ngTemplate.getTableName());
}
//Add embedded widgets
this._addEmbeddedWidgets(record.getValue('template'));
//Gather custom data table
var systemDataTables = [
'sp_instance',
'sp_instance_carousel',
'sp_instance_link',
'sp_instance_menu',
'sp_instance_table',
'sp_instance_vlist'
];
var widgetDataTable = record.getValue('data_table');
var isSystem = false;
for (var i = 0; i < systemDataTables.length; i++) {
if (systemDataTables[i] == widgetDataTable) {
isSystem = true;
break;
}
}
if (!isSystem) {
var dbObjRec = new GlideRecord('sys_db_object');
dbObjRec.addQuery('name', widgetDataTable);
dbObjRec.query();
if (dbObjRec.next())
this._addDbObject(dbObjRec, widgetDataTable);
}
this._gatherSPUserCriteria("sp_widget", record.getUniqueValue());
},
//Add Angular Provider
_addAngularProvider: function(record, tableName) {
this.saveRecord(record);
this._addEmbeddedWidgets(record.getValue('script'));
},
//Add NG Template
_addNgTemplate: function(record, tableName) {
this.saveRecord(record);
this._addEmbeddedWidgets(record.getValue('template'));
},
//Add Embedded Widgets from a script or template
_addEmbeddedWidgets: function(template) {
return;
/* Disabling until we can find a more effective method for this */
/*
var regExp = new RegExp('<sp-widget.*id=["\'](.*)["\']', 'g');
var widgetId = regExp.exec(template);
while (widgetId) {
var embeddedWidget = new GlideRecord("sp_widget");
embeddedWidget.addQuery("id", widgetId[1]);
embeddedWidget.query();
if (embeddedWidget.next()) {
this.saveRecord(embeddedWidget);
this._addWidgetDependencies(embeddedWidget);
}
widgetId = regExp.exec(template);
}
*/
},
//Recursively gather all required angular providers
_gatherRequiredProviders: function(provider) {
var requiredProviderM2M = new GlideRecord("m2m_sp_ng_pro_sp_ng_pro");
requiredProviderM2M.addQuery("required_by", provider.getUniqueValue());
requiredProviderM2M.query();
while (requiredProviderM2M.next()) {
var requiredProvider = new GlideRecord("sp_angular_provider");
if (requiredProvider.get(requiredProviderM2M.getValue('requires'))) {
this.saveRecord(requiredProvider);
this._gatherRequiredProviders(requiredProvider);
}
this.saveRecord(requiredProviderM2M);
}
return;
},
//Recursively gather all columns and column rows
_gatherColumnsAndColumnRowsAndInstances: function(row) {
//add columns
var column = new GlideRecord("sp_column");
column.addQuery("sp_row", row.getUniqueValue());
column.query();
while (column.next()) {
//Add widget instances
var widgetInstance = new GlideRecord("sp_instance");
widgetInstance.addQuery("sp_column", column.getUniqueValue());
widgetInstance.query();
while (widgetInstance.next()) {
//Add widget
var widget = new GlideRecord("sp_widget");
if (widget.get(widgetInstance.getValue('sp_widget'))) {
this.saveRecord(widget);
this._addWidgetDependencies(widget);
}
this.saveRecord(widgetInstance);
this._gatherSPUserCriteria("sp_instance", widgetInstance.getUniqueValue());
}
//Add column rows
var columnRow = new GlideRecord("sp_row");
columnRow.addQuery("sp_column", column.getUniqueValue());
columnRow.query();
while (columnRow.next()) {
this.saveRecord(columnRow);
this._gatherColumnsAndColumnRowsAndInstances(columnRow);
}
this.saveRecord(column);
}
return;
},
//Recursively gather all child menu rectangle items
_gatherChildMenuRectangleItems: function(menuRectangleItem) {
var childMenuRectangleItem = new GlideRecord("sp_rectangle_menu_item");
childMenuRectangleItem.addQuery("sp_rectangle_menu_item", menuRectangleItem.getUniqueValue());
childMenuRectangleItem.query();
while (childMenuRectangleItem.next()) {
this.saveRecord(childMenuRectangleItem);
this._gatherChildMenuRectangleItems(childMenuRectangleItem);
}
},
//Recursively gather all user criteria
_gatherSPUserCriteria: function(tableName, recID) {
if (new GlidePluginManager().isActive("com.glide.service-portal.user-criteria")) {
//Add user criteria
var availableForList = [];
var availableForTableName = "m2m_" + tableName + "_uc_can_view";
var availableForM2M = new GlideRecord(availableForTableName);
availableForM2M.addQuery(tableName, recID);
availableForM2M.query();
while (availableForM2M.next()) {
this.saveRecord(availableForM2M);
availableForList.push(availableForM2M.getValue("user_criteria"));
}
var notAvailableForList = [];
var notAvailableForTableName = "m2m_" + tableName + "_uc_cannot_view";
var notAvailableForM2M = new GlideRecord(notAvailableForTableName);
notAvailableForM2M.addQuery(tableName, recID);
notAvailableForM2M.query();
while (notAvailableForM2M.next()) {
this.saveRecord(notAvailableForM2M);
notAvailableForList.push(notAvailableForM2M.getValue("user_criteria"));
}
this._addUserCriteria(availableForList, notAvailableForList);
}
},
/********************* End Service Portal Functions *********************/
/********************* Begin Table & Dictionary Functions *********************/
//Add DB Object to the update set
_addDbObject: function(record, tableName) {
this._addTableDependencies(record);
},
//Add field to the update
_addField: function(record, tableName) {
//If current record is a 'collection' (table), add all table dependencies
if (record.internal_type.name.toString() == 'collection') {
this._addTableDependencies(record.getValue('name'));
} else {
this.saveRecord(record);
this._addFieldDependencies(record, tableName);
}
},
//Add table dependencies to the update set
_addTableDependencies: function(tableName) {
//If tableName isn't provided bail since all logic below is dependant on this value
if (gs.nil(tableName)) {
return;
}
if (typeof tableName == "string") {
//Add table record
var dbObject = new GlideRecord("sys_db_object");
dbObject.addQuery("name", tableName);
dbObject.query();
if (dbObject.next()) {
this.saveRecord(dbObject);
}
} else if (typeof tableName == "object" && tableName.getTableName() == "sys_db_object") {
this.saveRecord(tableName);
tableName = tableName.getValue('name');
} else {
return;
}
//Add number record
var sysNumber = new GlideRecord("sys_number");
sysNumber.addQuery("category", tableName);
sysNumber.query();
if (sysNumber.next()) {
this.saveRecord(sysNumber);
/*var numberCounter = new GlideRecord("sys_number_counter");
numberCounter.addQuery("table", tableName);
numberCounter.query();
if (numberCounter.next()) {
this.saveRecord(numberCounter);
}*/
}
//Add table fields
var tableField = new GlideRecord("sys_dictionary");
tableField.addQuery("name", tableName);
tableField.addQuery("element", "DOES NOT CONTAIN", "sys_").addOrCondition("element", null);
tableField.query();
while (tableField.next()) {
//Process table field
this.saveRecord(tableField);
//Process table field dependencies
this._addFieldDependencies(tableField);
}
//Add form & list elements
this._addFormDependencies(null, tableName);
//Add choices (redundant for non-extended fields)
var choice = new GlideRecord("sys_choice");
choice.addQuery("name", tableName);
choice.query();
while (choice.next())
this.saveRecord(choice);
//Add dictionary overrides (redundant for non-extended fields)
var override = new GlideRecord("sys_dictionary_override");
override.addQuery("name", tableName);
override.query();
while (override.next())
this.saveRecord(override);
//Add labels (redundant for non-extended fields)
var label = new GlideRecord("sys_documentation");
label.addQuery("name", tableName);
label.addQuery("element", "DOES NOT CONTAIN", "sys_");
label.query();
while (label.next())
this.saveRecord(label);
//Add field styles
var fieldStyle = new GlideRecord("sys_ui_style");
fieldStyle.addQuery("name", tableName);
fieldStyle.query();
while (fieldStyle.next())
this.saveRecord(fieldStyle);
//Add access controls, access roles, & roles (redundant for non-extended fields)
this._addACLDependencies(tableName);
//Add client scripts
var clientScript = new GlideRecord("sys_script_client");
clientScript.addQuery("table", tableName);
clientScript.query();
while (clientScript.next())
this.saveRecord(clientScript);
//Add business rules
var businessRule = new GlideRecord("sys_script");
businessRule.addQuery("collection", tableName);
businessRule.query();
while (businessRule.next())
this.saveRecord(businessRule);
//Add ui actions
var uiAction = new GlideRecord("sys_ui_action");
uiAction.addQuery("table", tableName);
uiAction.query();
while (uiAction.next()) {
this.saveRecord(uiAction);
var actionRole = new GlideRecord("sys_ui_action_role");
actionRole.addQuery("sys_ui_action", uiAction.getUniqueValue());
actionRole.query();
while (actionRole.next()) {
var role2 = new GlideRecord("sys_user_role");
if (role2.get(actionRole.getValue('sys_user_role')))
this.saveRecord(role2);
this.saveRecord(actionRole);
}
}
//Add ui policies
this._addUIPolicyDependencies(tableName);
//Add data policies
this._addDataPolicyDependencies(tableName);
//Add modules and applications (New Record & List of Records only)
var navModule = new GlideRecord("sys_app_module");
navModule.addQuery("name", tableName);
navModule.addQuery("link_type", "IN", "NEW,LIST");
navModule.query();
while (navModule.next()) {
var navApplication = new GlideRecord("sys_app_application");
if (navApplication.get(navModule.getValue('application')))
this.saveRecord(navApplication);
this.saveRecord(navModule);
}
//Check to see if table is a M2M and if so add that record
var sysM2M = new GlideRecord("sys_m2m");
sysM2M.addQuery("m2m_table", tableName);
sysM2M.query();
if (sysM2M.next()) {
this.saveRecord(sysM2M);
}
//Check to see if table is an import set and if so add transform maps and dependencies
if (this._getTableBase(tableName) == "sys_import_set_row") {
var transformMap = new GlideRecord("sys_transform_map");
transformMap.addQuery("source_table", tableName);
transformMap.query();
while (transformMap.next()) {
this._addTransformMap(transformMap, "sys_transform_map");
}
}
},
//Add form dependencies to the update set
_addFormDependencies: function(record, tableName) {
if (tableName == "sys_ui_form" && !gs.nil(record)) {
tableName = record.getValue("name");
}
//Add ui sections & elements
var uiSectionList = [];
var uiSection = new GlideRecord("sys_ui_section");
uiSection.addQuery("name", tableName);
//uiSection.addQuery("view","Default view");
uiSection.query();
while (uiSection.next()) {
this.saveRecord(uiSection);
uiSectionList.push(uiSection.getValue("sys_id"));
}
//Add form & elements
var formViewList = [];
var formView = new GlideRecord("sys_ui_form");
formView.addQuery("name", tableName);
//formView.addQuery("view","Default view");
formView.query();
while (formView.next()) {
this.saveRecord(formView);
formViewList.push(formView.getValue("sys_id"));
}
//Add form sections
var formSectionQuery = "sys_ui_formIN" + formViewList.toString();
formSectionQuery = formSectionQuery + "^ORsys_ui_sectionIN" + uiSectionList.toString();
var formSection = new GlideRecord("sys_ui_form_section");
formSection.addEncodedQuery(formSectionQuery);
formSection.query();
while (formSection.next()) {
this.saveRecord(formSection);
}
//Add section elements
var sectionElement = new GlideRecord("sys_ui_element");
sectionElement.addQuery("sys_ui_section", "IN", uiSectionList.toString());
sectionElement.query();
while (sectionElement.next()) {
//Add UI Formatter
if (!sectionElement.sys_ui_formatter.nil()) {
var uiFormatter = new GlideRecord("sys_ui_formatter");
uiFormatter.addQuery("sys_id", sectionElement.getValue('sys_ui_formatter'));
uiFormatter.setLimit(1);
uiFormatter.query();
if (uiFormatter.next())
this.saveRecord(uiFormatter);
}
this.saveRecord(sectionElement);
}
//Add list views
var listView = new GlideRecord("sys_ui_list");
listView.addQuery("name", tableName);
//listView.addQuery("view", "Default view");
listView.query();
while (listView.next())
this.saveRecord(listView);
//Add related lists
var relatedList = new GlideRecord("sys_ui_related_list");
relatedList.addQuery("name", tableName);
//relatedList.addQuery("view", "Default view");
relatedList.query();
while (relatedList.next()) {
this.saveRecord(relatedList);
var relatedListEntry = new GlideRecord("sys_ui_related_list_entry");
relatedListEntry.addQuery("list_id", relatedList.getUniqueValue());
relatedListEntry.query();
while (relatedListEntry.next())
this.saveRecord(relatedListEntry);
}
},
//Add access controls, access roles, & roles
_addACLDependencies: function(acl, tableName) {
var aclList = [];
if (!gs.nil(tableName) && tableName == "sys_security_acl") {
this.saveRecord(acl);
aclList.push(acl.getValue("sys_id"));
} else {
var aclTableName = acl;
acl = new GlideRecord("sys_security_acl");
acl.addQuery("name", aclTableName).addOrCondition("name", "STARTSWITH", aclTableName + '.');
acl.query();
while (acl.next()) {
this.saveRecord(acl);
aclList.push(acl.getValue("sys_id"));
}
}
var aclRole = new GlideRecord("sys_security_acl_role");
aclRole.addQuery("sys_security_acl", "IN", aclList.toString());
aclRole.query();
while (aclRole.next()) {
var role = new GlideRecord("sys_user_role");
if (role.get(aclRole.getValue('sys_user_role')))
this.saveRecord(role);
this.saveRecord(aclRole);
}
},
//Add UI policies to the update set
_addUIPolicyDependencies: function(uiPolicy, tableName) {
var uiPolicyList = [];
if (!gs.nil(tableName) && tableName == "sys_ui_policy") {
this.saveRecord(uiPolicy);
uiPolicyList.push(uiPolicy.getValue("sys_id"));
} else {
var uiPolicyTableName = uiPolicy;
uiPolicy = new GlideRecord("sys_ui_policy");
uiPolicy.addQuery("table", uiPolicyTableName);
uiPolicy.query();
while (uiPolicy.next()) {
this.saveRecord(uiPolicy);
uiPolicyList.push(uiPolicy.getValue("sys_id"));
}
}
var uiPolicyAction = new GlideRecord("sys_ui_policy_action");
uiPolicyAction.addQuery("ui_policy", "IN", uiPolicyList.toString());
uiPolicyAction.query();
while (uiPolicyAction.next())
this.saveRecord(uiPolicyAction);
},
//Add data policies
_addDataPolicyDependencies: function(dataPolicy, tableName) {
var dataPolicyList = [];
if (!gs.nil(tableName) && tableName == "sys_data_policy2") {
this.saveRecord(dataPolicy);
dataPolicyList.push(dataPolicy.getValue("sys_id"));
} else {
var dataPolicyTableName = dataPolicy;
dataPolicy = new GlideRecord("sys_data_policy2");
dataPolicy.addQuery("model_table", dataPolicyTableName);
dataPolicy.query();
while (dataPolicy.next()) {
this.saveRecord(dataPolicy);
dataPolicyList.push(dataPolicy.getValue("sys_id"));
}
}
var dataPolicyRule = new GlideRecord("sys_data_policy_rule");
dataPolicyRule.addQuery("sys_data_policy", "IN", dataPolicyList.toString());
dataPolicyRule.query();
while (dataPolicyRule.next())
this.saveRecord(dataPolicyRule);
},
//Add modules and applications
_addAppModuleDependencies: function(record, tableName) {
this.saveRecord(record);
var navModule = new GlideRecord("sys_app_module");
navModule.addQuery("application", record.getUniqueValue());
navModule.query();
while (navModule.next()) {
this.saveRecord(navModule);
}
},
//Add field dependencies to the update set
_addFieldDependencies: function(record, tableName) {
//Add choices
var choice = new GlideRecord("sys_choice");
choice.addQuery("name", record.getValue('name'));
choice.addQuery("element", record.getValue('element'));
choice.query();
while (choice.next())
this.saveRecord(choice);
//Add attributes
var attributeM2M = new GlideRecord("sys_schema_attribute_m2m");
attributeM2M.addQuery("schema", record.getUniqueValue());
attributeM2M.query();
while (attributeM2M.next()) {
//Add attribute
var attribute = new GlideRecord("sys_schema_attribute");
if (attribute.get(attributeM2M.getValue('attribute')))
this.saveRecord(attribute);
//Add attribute m2m
this.saveRecord(attributeM2M);
}
//Add labels
var label = new GlideRecord("sys_documentation");
label.addQuery("name", record.getValue('name'));
label.addQuery("element", record.getValue('element'));
label.query();
while (label.next())
this.saveRecord(label);
//Add field styles
var fieldStyle = new GlideRecord("sys_ui_style");
fieldStyle.addQuery("name", record.getValue('name'));
fieldStyle.addQuery("element", record.getValue('element'));
fieldStyle.query();
while (fieldStyle.next())
this.saveRecord(fieldStyle);
//Add dictionary overrides
var override = new GlideRecord("sys_dictionary_override");
override.addQuery("name", record.getValue('name'));
override.addQuery("element", record.getValue('element'));
override.query();
while (override.next())
this.saveRecord(override);
//Add access controls, access roles, & roles (redundant for non-extended fields)
var acl = new GlideRecord("sys_security_acl");
acl.addQuery("name", record.getValue('name') + '.' + record.getValue('element'));
acl.query();
while (acl.next()) {
this.saveRecord(acl);
var aclRole = new GlideRecord("sys_security_acl_role");
aclRole.addQuery("sys_security_acl", acl.getUniqueValue());
aclRole.query();
while (aclRole.next()) {
var role = new GlideRecord("sys_user_role");
if (role.get(aclRole.getValue('sys_user_role')))
this.saveRecord(role);
this.saveRecord(aclRole);
}
}
},
//Add Database View
_addDbView: function(record, tableName) {
this.saveRecord(record);
//Add Database View Table
var dbViewTable = new GlideRecord("sys_db_view_table");
dbViewTable.addQuery("view", record.getUniqueValue());
dbViewTable.query();
while (dbViewTable.next()) {
this.saveRecord(dbViewTable);
//Add Database View Fields
var dbViewField = new GlideRecord("sys_db_view_table_field");
dbViewField.addQuery("view_table", dbViewTable.getUniqueValue());
dbViewField.query();
while (dbViewField.next()) {
this.saveRecord(dbViewField);
}
//Add dependent tables
if (this.includeDbViewTables) {
var dbViewSysDbObject = new GlideRecord("sys_db_object");
dbViewSysDbObject.addQuery("name", dbViewTable.getValue('table'));
dbViewSysDbObject.query();
if (dbViewSysDbObject.next()) {
this._addDbObject(dbViewSysDbObject);
}
}
}
},
/********************* End Table & Dictionary Functions *********************/
/********************* Begin Integrations Functions *********************/
_addRestMessage: function(restMessage, tableName) {
var recID;
if (typeof restMessage == "string") {
recID = restMessage;
restMessage = new GlideRecord("sys_rest_message");
restMessage.get(recID);
}
this.saveRecord(restMessage);
recID = restMessage.getValue("sys_id");
var httpHeader = new GlideRecord("sys_rest_message_headers");
httpHeader.addQuery("rest_message", recID);
httpHeader.query();
while (httpHeader.next()) {
this.saveRecord(httpHeader);
}
this._addBasicAuthProfile(restMessage.getValue("basic_auth_profile"));
var restFunction = new GlideRecord("sys_rest_message_fn");
restFunction.addQuery("rest_message", recID);
restFunction.query();
while (restFunction.next()) {
this._addRestFunction(restFunction);
}
},
_addRestFunction: function(restFunction, tableName) {
var recID;
if (typeof restFunction == "string") {
recID = restFunction;
restFunction = new GlideRecord("sys_rest_message_fn");
restFunction.get(recID);
}
this.saveRecord(restFunction);
recID = restFunction.getValue("sys_id");
var httpHeader = new GlideRecord("sys_rest_message_fn_headers");
httpHeader.addQuery("rest_message_function", recID);
httpHeader.query();
while (httpHeader.next()) {
this.saveRecord(httpHeader);
}
this._addBasicAuthProfile(restFunction.getValue("basic_auth_profile"));
var queryParameter = new GlideRecord("sys_rest_message_fn_param_defs");
queryParameter.addQuery("rest_message_function", recID);
queryParameter.query();
while (queryParameter.next()) {
this.saveRecord(queryParameter);
}
var varSubstitution = new GlideRecord("sys_rest_message_fn_parameters");
varSubstitution.addQuery("rest_message_function", recID);
varSubstitution.query();
while (varSubstitution.next()) {
this.saveRecord(varSubstitution);
}
},
//Add Scripted REST service
_addScriptedRestService: function(record, tableName) {
this.saveRecord(record);
//Add REST resources
var restResource = new GlideRecord("sys_ws_operation");
restResource.addQuery("web_service_definition", record.getUniqueValue());
restResource.query();
while (restResource.next()) {
this._addScriptedRestResource(restResource, restResource.getTableName());
}
//Add ACLs
if (!record.enforce_acl.nil()) {
var aclArray = [];
if (!record.enforce_acl.nil()){
aclArray = record.getValue('enforce_acl').split(',');
}
for (var i = 0; i < aclArray.length; i++) {
var aclRec = new GlideRecord('sys_security_acl');
if (aclRec.get(aclArray[i])) {
this._addACLDependencies(aclRec, aclRec.getTableName());
}
}
}
},
//Add Scripted REST resource
_addScriptedRestResource: function(record, tableName) {
this.saveRecord(record);
//Add REST Service
var restService = new GlideRecord("sys_ws_definition");
if (restService.get(record.getValue('web_service_definition'))) {
this.saveRecord(restService);
}
//Add Query Parameter M2M
var queryParamM2M = new GlideRecord("sys_ws_query_parameter_map");
queryParamM2M.addQuery("web_service_operation", record.getUniqueValue());
queryParamM2M.query();
while (queryParamM2M.next()) {
//Add Query Parameter
var queryParam = new GlideRecord("sys_ws_query_parameter");
if (queryParam.get(queryParamM2M.getValue('web_service_query_parameter'))) {
this.saveRecord(queryParam);
}
this.saveRecord(queryParamM2M);
}
//Add REST Header M2M
var restHeaderM2M = new GlideRecord("sys_ws_header_map");
restHeaderM2M.addQuery("web_service_operation", record.getUniqueValue());
restHeaderM2M.query();
while (restHeaderM2M.next()) {
//Add Header
var restHeader = new GlideRecord("sys_ws_header");
if (restHeader.get(restHeaderM2M.getValue('web_service_header'))) {
this.saveRecord(restHeader);
}
this.saveRecord(restHeaderM2M);
}
//Add ACLs
if (!record.enforce_acl.nil()) {
var aclArray = [];
if (!record.enforce_acl.nil()){
aclArray = record.getValue('enforce_acl').split(',');
}
for (var i = 0; i < aclArray.length; i++) {
var aclRec = new GlideRecord('sys_security_acl');
if (aclRec.get(aclArray[i])) {
this._addACLDependencies(aclRec, aclRec.getTableName());
}
}
}
},
//Add Scripted SOAP service
_addScriptedSoapService: function(record, tableName) {
this.saveRecord(record);
//Add Input Parameters
var soapInputParameter = new GlideRecord("sys_web_service_input");
soapInputParameter.addQuery("web_service", record.getUniqueValue());
soapInputParameter.query();
while (soapInputParameter.next()) {
this.saveRecord(soapInputParameter);
}
//Add OutputParameters
var soapOutputParameter = new GlideRecord("sys_web_service_output");
soapOutputParameter.addQuery("web_service", record.getUniqueValue());
soapOutputParameter.query();
while (soapOutputParameter.next()) {
this.saveRecord(soapOutputParameter);
}
},
_addSoapMessage: function(soapMessage, tableName) {
var recID;
if (typeof soapMessage == "string") {
recID = soapMessage;
soapMessage = new GlideRecord("sys_soap_message");
soapMessage.get(recID);
}
this.saveRecord(soapMessage);
recID = soapMessage.getValue("sys_id");
this._addBasicAuthProfile(soapMessage.getValue("basic_auth_profile"));
var soapFunction = new GlideRecord("sys_soap_message_function");
soapFunction.addQuery("soap_message", recID);
soapFunction.query();
while (soapFunction.next()) {
this._addSoapFunction(soapFunction);
}
},
_addSoapFunction: function(soapFunction, tableName) {
var recID;
if (typeof soapFunction == "string") {
recID = soapFunction;
soapFunction = new GlideRecord("sys_rest_message_fn");
soapFunction.get(recID);
}
this.saveRecord(soapFunction);
recID = soapFunction.getValue("sys_id");
this._addBasicAuthProfile(soapFunction.getValue("basic_auth_profile"));
var varSubstitution = new GlideRecord("sys_soap_message_parameters");
varSubstitution.addQuery("soap_function", recID);
varSubstitution.query();
while (varSubstitution.next()) {
this.saveRecord(varSubstitution);
}
},
_addTransformMap: function(transformMap, tableName) {
this.saveRecord(transformMap);
var recID = transformMap.getValue("sys_id");
var fieldMap = new GlideRecord("sys_transform_entry");
fieldMap.addQuery("map", recID);
fieldMap.query();
while (fieldMap.next()) {
this.saveRecord(fieldMap);
}
var transformScript = new GlideRecord("sys_transform_script");
transformScript.addQuery("map", recID);
transformScript.query();
while (transformScript.next()) {
this.saveRecord(transformScript);
}
},
_addBasicAuthProfile: function(basicAuthProfileID) {
if (gs.nil(basicAuthProfileID)) {
return;
}
var basicAuthProfile = new GlideRecord("sys_auth_profile_basic");
if (basicAuthProfile.get(basicAuthProfileID)) {
this.saveRecord(basicAuthProfile);
}
},
/********************* End Integrations Functions *********************/
addScheduledJob: function(scheduleJobFields) {
var scheduledJob = new GlideRecord("sys_trigger");
scheduledJob.newRecord();
var keys = Object.keys(scheduleJobFields).toString();
var keysList = keys.split(",");
for (var i = 0; i < keysList.length; i++) {
var fieldName = keysList[i].trim();
var fieldValue = scheduleJobFields[fieldName].trim();
if (!gs.nil(fieldValue) && scheduledJob.isValidField(fieldName)) {
scheduledJob[fieldName] = fieldValue;
}
}
this.saveRecord(scheduledJob, false);
},
parseTemplateString: function(templateString) {
var templateObject = {};
var templateArray = templateString.toString().split("^");
for (var i = 0; i < templateArray.length; i++) {
var fieldPair = templateArray[i].toString().split("=");
templateObject[fieldPair[0]] = fieldPair[1];
}
return templateObject;
},
/********************* Begin Event Management Functions *********************/
_addEMRule: function(emRule, tableName) {
this.saveRecord(emRule);
var emRuleID = emRule.getValue("sys_id");
var composeField = new GlideRecord("em_compose_field");
composeField.addQuery("match_rule", emRuleID);
composeField.query();
while (composeField.next()) {
this.saveRecord(composeField);
}
var matchField = new GlideRecord("em_match_field");
matchField.addQuery("match_rule", emRuleID);
matchField.query();
while (matchField.next()) {
this.saveRecord(matchField);
}
},
/********************* End Event Management Functions *********************/
/********************* Begin Discovery Functions *********************/
_addDiscoverySchedule: function(discoverySchedule, tableName) {
this.saveRecord(discoverySchedule);
var discoveryScheduleID = discoverySchedule.getValue("sys_id");
var ipRangeItem = new GlideRecord("discovery_range_item");
ipRangeItem.addQuery("schedule", discoveryScheduleID);
ipRangeItem.query();
while (ipRangeItem.next()) {
this._addDiscoveryRangeItem(ipRangeItem);
}
var scheduleRange = new GlideRecord("discovery_schedule_range");
scheduleRange.addQuery("dscheduler", discoveryScheduleID);
scheduleRange.query();
while (scheduleRange.next()) {
this.saveRecord(scheduleRange);
this._addDiscoveryRangeSet(scheduleRange.getValue("range"));
}
if (!gs.nil(discoverySchedule.getValue("behavior"))) {
this._addDiscoveryBehavior(discoverySchedule.getValue("behavior"));
}
},
_addDiscoveryRangeSet: function(discoveryRangeSet, tableName) {
var recID;
if (typeof discoveryRangeSet == "string") {
recID = discoveryRangeSet;
discoveryRangeSet = new GlideRecord("discovery_range");
discoveryRangeSet.get(recID);
}
this.saveRecord(discoveryRangeSet);
recID = discoveryRangeSet.getValue("sys_id");
if (!gs.nil(discoveryRangeSet.getValue("behavior"))) {
this._addDiscoveryBehavior(discoveryRangeSet.getValue("behavior"));
}
var ipRangeItem = new GlideRecord("discovery_range_item");
ipRangeItem.addQuery("parent", recID);
ipRangeItem.query();
while (ipRangeItem.next()) {
this._addDiscoveryRangeItem(ipRangeItem);
}
},
_addDiscoveryRangeItem: function(rangeItem) {
this.saveRecord(rangeItem);
var ipRangeItemExcludeList = [];
var ipRangeItemExclude = new GlideRecord("discovery_range_item_exclude");
ipRangeItemExclude.addQuery("parent", rangeItem.getValue("sys_id"));
ipRangeItemExclude.query();
while (ipRangeItemExclude.next()) {
this.saveRecord(ipRangeItemExclude);
ipRangeItemExcludeList.push(ipRangeItemExclude.getValue("sys_id"));
}
var rangeItemIP = new GlideRecord("discovery_range_item_ip");
rangeItemIP.addQuery("exclude_parent", "IN", ipRangeItemExcludeList.toString());
rangeItemIP.query();
while (rangeItemIP.next()) {
this.saveRecord(rangeItemIP);
ipRangeItemExcludeList.push(rangeItemIP.getValue("sys_id"));
}
},
_addDiscoveryBehavior: function(discoveryBehavior, tableName) {
var recID;
if (typeof discoveryBehavior == "string") {
recID = discoveryBehavior;
discoveryBehavior = new GlideRecord("discovery_behavior");
discoveryBehavior.get(recID);
}
if (!discoveryBehavior.isValidRecord()) {
return;
}
this.saveRecord(discoveryBehavior);
recID = discoveryBehavior.getValue("sys_id");
var functionalityDefinition = new GlideRecord("discovery_functionality");
if (functionalityDefinition.get(discoveryBehavior.getValue("functionality"))) {
this.saveRecord(functionalityDefinition);
}
var functionCriterion = new GlideRecord("discovery_func_criterion");
functionCriterion.addQuery("functionality", recID);
functionCriterion.query();
while (functionCriterion.next()) {
this.saveRecord(functionCriterion);
}
},
/********************* End Discovery Functions *********************/
/********************* Begin ETL Functions *********************/
//==================================================================================
// Thanks to Alexis Osborne for these contributions to ATUS!
// Must start on cmdb_inst_application_feed. Select Add To UpdateSet in Related Links
// All associated data for the ETL will be pulled into the current update set
//==================================================================================
_addETL: function(tableRec, tableName) {
var etlID;
if (typeof tableRec == "string") {
etlID = tableRec;
tableRec = new GlideRecord("cmdb_inst_application_feed"); //verified
tableRec.get(etlID);
}
// CMDB Integration Studio Application Data Source (cmdb_inst_application_feed) - extends Robust Transform Engine Entity Based Definition (sys_rte_definition)
this.saveRecord(tableRec);
etlID = tableRec.getValue("sys_id");
// var rteDef = new GlideRecord("sys_rte_definition");
// rteDef.addQuery("sys_rte_eb_definition", etlID);
// rteDef.query();
// while (rteDef.next()) {
// this.saveRecord(rteDef);
// }
// Get upstream references *******************************************
// ETL CMDB Integration Studio Application
var instApp = new GlideRecord("cmdb_inst_application"); //verified
instApp.addQuery("sys_id", tableRec.cmdb_inst_application);
instApp.query();
while (instApp.next()) {
this.saveRecord(instApp);
}
// Data Source
var dataSource = new GlideRecord("sys_data_source");
dataSource.addQuery("sys_id", tableRec.getValue('sys_data_source'));
dataSource.query();
while (dataSource.next()) {
this.saveRecord(dataSource);
// Scheduled Data Import
var schDataImport = new GlideRecord("scheduled_import_set");
schDataImport.addQuery("data_source", dataSource.getUniqueValue());
schDataImport.query();
while (schDataImport.next()) {
this.saveRecord(schDataImport);
}
}
// End upstream references *******************************************
// Begin Downstream tables *******************************************
// Get downstream references- CMDB Integration Studio Entity(cmdb_inst_entity) extends(sys_rte_eb_entity) - only query against parent table
// var instEntity = new GlideRecord("cmdb_inst_entity");
// instEntity.addQuery("sys_rte_eb_definition", etlID);
// instEntity.query();
// while (instEntity.next()) {
// this.saveRecord(instEntity);
// }
// Get downstream references- Robust Transform Engine Entity
var retEBEntity = new GlideRecord("sys_rte_eb_entity"); // confirm - extended by cmdb_inst_entity
retEBEntity.addQuery("sys_rte_eb_definition", etlID);
retEBEntity.query();
while (retEBEntity.next()) {
this.saveRecord(retEBEntity);
}
// dependent tables(tabs): sys_rte_eb_field(done) sys_rte_eb_operation(done)
// Get downstream references- CMDB Intgration Studio Entry dependent table: Robust Transform Engine Entity Field (sys_rte_eb_field)
var rteEBField = new GlideRecord("sys_rte_eb_field"); // verified
rteEBField.addQuery("sys_rte_eb_definition", etlID);
rteEBField.query();
while (rteEBField.next()) {
this.saveRecord(rteEBField);
}
// Get downstream references- CMDB Intgration Studio Entry dependent tables: Robust Transform Engine Entity Template Operation (22) sys_rte_eb_*
// This is a base table for a large number of sys_rte_eb_* tables. Robust Transform Engine Entity ...Cleanse, Derive, Create...
// var rteEBOp = new GlideRecord("sys_rte_eb_operation"); // verified
// rteEBOp.addQuery("sys_rte_eb_definition", etlID);
// rteEBOp.query();
// while (rteEBOp.next()) {
// this.saveRecord(rteEBOp);
// }
var rteConcat = new GlideRecord("sys_rte_eb_concat_operation"); // verified
rteConcat.addQuery("sys_rte_eb_definition", etlID);
rteConcat.query();
while (rteConcat.next()) {
this.saveRecord(rteConcat);
}
var rteCopy = new GlideRecord("sys_rte_eb_copy_operation"); // verified
rteCopy.addQuery("sys_rte_eb_definition", etlID);
rteCopy.query();
while (rteCopy.next()) {
this.saveRecord(rteCopy);
}
var rteExNum = new GlideRecord("sys_rte_eb_extract_numeric_operation"); // verified
rteExNum.addQuery("sys_rte_eb_definition", etlID);
rteExNum.query();
while (rteExNum.next()) {
this.saveRecord(rteExNum);
}
var rteGlide = new GlideRecord("sys_rte_eb_glide_lookup_operation"); // verified
rteGlide.addQuery("sys_rte_eb_definition", etlID);
rteGlide.query();
while (rteGlide.next()) {
this.saveRecord(rteGlide);
}
var rteMinMax = new GlideRecord("sys_rte_eb_min_max_operation"); // verified
rteMinMax.addQuery("sys_rte_eb_definition", etlID);
rteMinMax.query();
while (rteMinMax.next()) {
this.saveRecord(rteMinMax);
}
var rteMulti = new GlideRecord("sys_rte_eb_multi_in_script_operation"); // verified
rteMulti.addQuery("sys_rte_eb_definition", etlID);
rteMulti.query();
while (rteMulti.next()) {
this.saveRecord(rteMulti);
}
var rteRegex = new GlideRecord("sys_rte_eb_regex_replace_operation"); // verified
rteRegex.addQuery("sys_rte_eb_definition", etlID);
rteRegex.query();
while (rteRegex.next()) {
this.saveRecord(rteRegex);
}
var rteRepl = new GlideRecord("sys_rte_eb_replace_operation"); // verified
rteRepl.addQuery("sys_rte_eb_definition", etlID);
rteRepl.query();
while (rteRepl.next()) {
this.saveRecord(rteRepl);
}
var rteRound = new GlideRecord("sys_rte_eb_round_numeric_operation"); // verified
rteRound.addQuery("sys_rte_eb_definition", etlID);
rteRound.query();
while (rteRound.next()) {
this.saveRecord(rteRound);
}
var rteScript = new GlideRecord("sys_rte_eb_script_operation"); // verified
rteScript.addQuery("sys_rte_eb_definition", etlID);
rteScript.query();
while (rteScript.next()) {
this.saveRecord(rteScript);
}
var rteSet = new GlideRecord("sys_rte_eb_set_operation"); // verified
rteSet.addQuery("sys_rte_eb_definition", etlID);
rteSet.query();
while (rteSet.next()) {
this.saveRecord(rteSet);
}
var rteSplit = new GlideRecord("sys_rte_eb_split_operation"); // verified
rteSplit.addQuery("sys_rte_eb_definition", etlID);
rteSplit.query();
while (rteSplit.next()) {
this.saveRecord(rteSplit);
}
var rteTempl = new GlideRecord("sys_rte_eb_template_operation"); // verified
rteTempl.addQuery("sys_rte_eb_definition", etlID);
rteTempl.query();
while (rteTempl.next()) {
this.saveRecord(rteTempl);
}
var rteBoo = new GlideRecord("sys_rte_eb_to_boolean_operation"); // verified
rteBoo.addQuery("sys_rte_eb_definition", etlID);
rteBoo.query();
while (rteBoo.next()) {
this.saveRecord(rteBoo);
}
var rteDate = new GlideRecord("sys_rte_eb_to_date_operation"); // verified
rteDate.addQuery("sys_rte_eb_definition", etlID);
rteDate.query();
while (rteDate.next()) {
this.saveRecord(rteDate);
}
var rteToNum = new GlideRecord("sys_rte_eb_to_numeric_operation"); // verified
rteToNum.addQuery("sys_rte_eb_definition", etlID);
rteToNum.query();
while (rteToNum.next()) {
this.saveRecord(rteToNum);
}
var rteTrim = new GlideRecord("sys_rte_eb_trim_operation"); // verified
rteTrim.addQuery("sys_rte_eb_definition", etlID);
rteTrim.query();
while (rteTrim.next()) {
this.saveRecord(rteTrim);
}
var rteUp = new GlideRecord("sys_rte_eb_upper_case_operation"); // verified
rteUp.addQuery("sys_rte_eb_definition", etlID);
rteUp.query();
while (rteUp.next()) {
this.saveRecord(rteUp);
}
var rteUpTrim = new GlideRecord("sys_rte_eb_upper_case_trim_operation");
rteUpTrim.addQuery("sys_rte_eb_definition", etlID);
rteUpTrim.query();
while (rteUpTrim.next()) {
this.saveRecord(rteUpTrim);
}
// Get downstream references- Robust Transform Engine Entity Mapping
var rteEBEntMap = new GlideRecord("sys_rte_eb_entity_mapping"); //verified
rteEBEntMap.addQuery("sys_rte_eb_definition", etlID);
rteEBEntMap.query();
while (rteEBEntMap.next()) {
this.saveRecord(rteEBEntMap);
}
// Get downstream references- Robust TRansform Engine Entity Field Mappings
var rteEBFieldMap = new GlideRecord("sys_rte_eb_field_mapping"); //verified
rteEBFieldMap.addQuery("sys_rte_eb_definition", etlID);
rteEBFieldMap.query();
while (rteEBFieldMap.next()) {
this.saveRecord(rteEBFieldMap);
}
// Get downstream references- Robust Transform Engine Entity Template Operations -- base table for all of the sn_cmdb_int_cleanse_* functions.
//Robust Transform Engine Entity Cleanse IP Version Operation
var cIPVersion = new GlideRecord("sn_cmdb_int_util_cleanse_ip_version_operation");
cIPVersion.addQuery("sys_rte_eb_definition", etlID);
cIPVersion.query();
while (cIPVersion.next()) {
this.saveRecord(cIPVersion);
}
//Robust Transform Engine Entity Cleanse MAC Operation
var cMacOper = new GlideRecord("sn_cmdb_int_util_cleanse_mac_operation");
cMacOper.addQuery("sys_rte_eb_definition", etlID);
cMacOper.query();
while (cMacOper.next()) {
this.saveRecord(cMacOper);
}
//Robust Transform Engine Entity Cleanse OS Operation
var cOSOper = new GlideRecord("sn_cmdb_int_util_cleanse_os_operation");
cOSOper.addQuery("sys_rte_eb_definition", etlID);
cOSOper.query();
while (cOSOper.next()) {
this.saveRecord(cOSOper);
}
//Robust Transform Engine Entity Cleanse Serial Number Operation
var cSerialNum = new GlideRecord("sn_cmdb_int_util_cleanse_serial_number_operation");
cSerialNum.addQuery("sys_rte_eb_definition", etlID);
cSerialNum.query();
while (cSerialNum.next()) {
this.saveRecord(cSerialNum);
}
//Robust Transform Engine Entity Cleanse Software Model Operation
var cSoftWModel = new GlideRecord("sn_cmdb_int_util_cleanse_software_model_operation");
cSoftWModel.addQuery("sys_rte_eb_definition", etlID);
cSoftWModel.query();
while (cSoftWModel.next()) {
this.saveRecord(cSoftWModel);
}
// //Robust Transform Engine Entity Create Software Instance Name Operation
var cSoftwInstName = new GlideRecord("sn_cmdb_int_util_create_software_instance_name_operation");
cSoftwInstName.addQuery("sys_rte_eb_definition", etlID);
cSoftwInstName.query();
while (cSoftwInstName.next()) {
this.saveRecord(cSoftwInstName);
}
// //Robust Transform Engine Entity Derive Class From Model Operation
var dClassFrmModel = new GlideRecord("sn_cmdb_int_util_derive_class_from_model_operation");
dClassFrmModel.addQuery("sys_rte_eb_definition", etlID);
dClassFrmModel.query();
while (dClassFrmModel.next()) {
this.saveRecord(dClassFrmModel);
}
//Robust Transform Engine Entity Derive Class From Native Value Operation
var dClassFromNativeV = new GlideRecord("sn_cmdb_int_util_derive_class_from_native_value_operation");
dClassFromNativeV.addQuery("sys_rte_eb_definition", etlID);
dClassFromNativeV.query();
while (dClassFromNativeV.next()) {
this.saveRecord(dClassFromNativeV);
}
//Robust Transform Engine Entity Derive Class From OS Operation
var dClassFromOS = new GlideRecord("sn_cmdb_int_util_derive_class_from_os_operation");
dClassFromOS.addQuery("sys_rte_eb_definition", etlID);
dClassFromOS.query();
while (dClassFromOS.next()) {
this.saveRecord(dClassFromOS);
}
//Robust Transform Engine Entity Derive Virtual From Model Operation
var dVirtualFromModel = new GlideRecord("sn_cmdb_int_util_derive_virtual_from_model_operation");
dVirtualFromModel.addQuery("sys_rte_eb_definition", etlID);
dVirtualFromModel.query();
while (dVirtualFromModel.next()) {
this.saveRecord(dVirtualFromModel);
}
//Robust Transform Engine Entity Derive Virtual From Native Value Operation
var dVirtualFromNativeV = new GlideRecord("sn_cmdb_int_util_derive_virtual_from_native_value_operation");
dVirtualFromNativeV.addQuery("sys_rte_eb_definition", etlID);
dVirtualFromNativeV.query();
while (dVirtualFromNativeV.next()) {
this.saveRecord(dVirtualFromNativeV);
}
//Robust Transform Engine Entity Derive Virtual From Serial Number Operation
var dVirtualFromSerialNum = new GlideRecord("sn_cmdb_int_util_derive_virtual_from_serial_number_operation");
dVirtualFromSerialNum.addQuery("sys_rte_eb_definition", etlID);
dVirtualFromSerialNum.query();
while (dVirtualFromSerialNum.next()) {
this.saveRecord(dVirtualFromSerialNum);
}
//Robust Transform Engine Entity Extract and Scale by Units Operation
var extractScale = new GlideRecord("sn_cmdb_int_util_extract_and_scale_by_units_operation");
extractScale.addQuery("sys_rte_eb_definition", etlID);
extractScale.query();
while (extractScale.next()) {
this.saveRecord(extractScale);
}
//Robust Transform Engine Entity First Non Null Value Operation
var firstNonNull = new GlideRecord("sn_cmdb_int_util_first_non_null_operation");
firstNonNull.addQuery("sys_rte_eb_definition", etlID);
firstNonNull.query();
while (firstNonNull.next()) {
this.saveRecord(firstNonNull);
}
//Robust Transform Engine Entity Process FQDN Operation
var processFQDN = new GlideRecord("sn_cmdb_int_util_process_fqdn_operation");
processFQDN.addQuery("sys_rte_eb_definition", etlID);
processFQDN.query();
while (processFQDN.next()) {
this.saveRecord(processFQDN);
}
//Robust Transform Engine Entity Process Name Set Operation
var nameSet = new GlideRecord("sn_cmdb_int_util_process_name_set_operation");
nameSet.addQuery("sys_rte_eb_definition", etlID);
nameSet.query();
while (nameSet.next()) {
this.saveRecord(nameSet);
}
//Robust Transform Engine Entity Scale Unit Operation
var scaleUnit = new GlideRecord("sn_cmdb_int_util_scale_unit_operation");
scaleUnit.addQuery("sys_rte_eb_definition", etlID);
scaleUnit.query();
while (scaleUnit.next()) {
this.saveRecord(scaleUnit);
}
//Robust Transform Engine Entity Software Bundle Id Lookup Operation
var softwareBundle = new GlideRecord("sn_cmdb_int_util_software_bundle_id_lookup_operation");
softwareBundle.addQuery("sys_rte_eb_definition", etlID);
softwareBundle.query();
while (softwareBundle.next()) {
this.saveRecord(softwareBundle);
}
//Robust Transform Engine Entity User Lookup Operation
var userLookup = new GlideRecord("sn_cmdb_int_util_user_lookup_operation");
userLookup.addQuery("sys_rte_eb_definition", etlID);
userLookup.query();
while (userLookup.next()) {
this.saveRecord(userLookup);
}
// Get downstream references - Robust Import Set Transformer
var robustTrans = new GlideRecord("sys_robust_import_set_transformer"); // verified
robustTrans.addQuery("robust_transform_engine", etlID);
robustTrans.query();
while (robustTrans.next()) {
this.saveRecord(robustTrans);
}
//==================================================================================
// No rows, not included:
// sys_rte_pattern
// sys_rte_transformer_definition
//sn_cmdb_int_util_class_recommendation_state -- no rows at this time
//sn_int_studio_template_state - do not capture - reference to import set (transient data)
//==================================================================================
},
/********************* End ETL Functions *********************/
/********************* Begin AI Search Functions *********************/
_addSearchContext: function(tableRec, tableName) {
this.saveRecord(tableRec);
var searchContextID = tableRec.getValue("sys_id");
if (tableRec.getValue('search_engine') == 'zing') {
var searchSourceM2M = new GlideRecord("m2m_search_context_config_search_source");
searchSourceM2M.addQuery("search_context_config", searchContextID);
searchSourceM2M.query();
while (searchSourceM2M.next()) {
var searchSource = searchSourceM2M.source.getRefRecord();
this.saveRecord(searchSource);
this.saveRecord(searchSourceM2M);
}
}
if (tableRec.getValue('search_engine') == 'ai_search') {
var searchProfileRec = tableRec.search_profile.getRefRecord();
this._addAiSearchProfile(searchProfileRec, searchProfileRec.getTableName());
var searchFacet = new GlideRecord("sys_search_facet");
searchFacet.addQuery("search_context_config", searchContextID);
searchFacet.query();
while (searchFacet.next()) {
this.saveRecord(searchFacet);
}
var searchFilter = new GlideRecord("sys_search_filter");
searchFilter.addQuery("search_context_config", searchContextID);
searchFilter.query();
while (searchFilter.next()) {
this.saveRecord(searchFilter);
}
var searchSuggestion = new GlideRecord("sys_suggestion_reader_group");
searchSuggestion.addQuery("context_config_id", searchContextID);
searchSuggestion.query();
while (searchSuggestion.next()) {
this.saveRecord(searchSuggestion);
}
var searchScriptedPostProcessorM2M = new GlideRecord("m2m_search_context_config_search_scripted_processor");
searchScriptedPostProcessorM2M.addQuery("search_context_config", searchContextID);
searchScriptedPostProcessorM2M.query();
while (searchScriptedPostProcessorM2M.next()) {
var searchScriptedProcessorRec = searchScriptedPostProcessorM2M.search_scripted_processor.getRefRecord();
this.saveRecord(searchScriptedProcessorRec);
this.saveRecord(searchScriptedPostProcessorM2M);
}
var searchSortOption = new GlideRecord("sys_search_sort_option");
searchSortOption.addQuery("search_context_config", searchContextID);
searchSortOption.query();
while (searchSortOption.next()) {
this.saveRecord(searchSortOption);
}
}
},
_addAiSearchProfile: function(tableRec, tableName) {
this.saveRecord(tableRec);
var profileID = tableRec.getValue("sys_id");
var searchSourceM2M = new GlideRecord("ais_search_profile_ais_search_source_m2m");
searchSourceM2M.addQuery("profile", profileID);
searchSourceM2M.query();
while (searchSourceM2M.next()) {
var searchSource = searchSourceM2M.search_source.getRefRecord();
this._addAiSearchSource(searchSource, searchSource.getTableName());
this.saveRecord(searchSourceM2M);
}
var dictRecM2M = new GlideRecord("ais_search_profile_ais_dictionary_m2m");
dictRecM2M.addQuery("profile", profileID);
dictRecM2M.query();
while (dictRecM2M.next()) {
var dictionaryRec = tableRec.dictionary.getRefRecord();
this._addDictionary(dictionaryRec, dictionaryRec.getTableName());
this.saveRecord(dictRecM2M);
}
var geniusRecM2M = new GlideRecord("ais_search_profile_ais_genius_result_configuration_m2m");
geniusRecM2M.addQuery("profile", profileID);
geniusRecM2M.query();
while (geniusRecM2M.next()) {
var geniusRec = tableRec.genius_result_configuration.getRefRecord();
this.saveRecord(geniusRec);
this.saveRecord(geniusRecM2M);
}
var resultImpRule = new GlideRecord("ais_rule");
resultImpRule.addQuery("profile", profileID);
resultImpRule.query();
while (resultImpRule.next()) {
this.saveRecord(resultImpRule);
var actionRec = new GlideRecord("ais_rule_action");
actionRec.addQuery("rule", resultImpRule.getValue('sys_id'));
actionRec.query();
while (actionRec.next()) {
this.saveRecord(actionRec);
}
}
},
_addAiSearchSource: function(tableRec, tableName) {
this.saveRecord(tableRec);
var aiSearchDatasource = tableRec.datasource.getRefRecord();
this._addAiSearchDatasource(aiSearchDatasource, aiSearchDatasource.getTableName());
},
_addAiSearchDatasource: function(tableRec, tableName) {
this.saveRecord(tableRec);
var dataSourceID = tableRec.getValue("sys_id");
var childTable = new GlideRecord("ais_child_table");
childTable.addQuery("datasource", dataSourceID);
childTable.query();
while (childTable.next()) {
this.saveRecord(childTable);
}
var indSourceAttribute = new GlideRecord("ais_datasource_attribute");
indSourceAttribute.addQuery("datasource", dataSourceID);
indSourceAttribute.query();
while (indSourceAttribute.next()) {
var confAttribute = new GlideRecord("ais_configuration_attribute");
confAttribute.addQuery("sys_id", indSourceAttribute.getValue('attribute'));
confAttribute.query();
if (confAttribute.next()) {
this.saveRecord(confAttribute);
}
this.saveRecord(indSourceAttribute);
}
var fieldSetting = new GlideRecord("ais_datasource_field_attribute");
fieldSetting.addQuery("datasource", dataSourceID);
fieldSetting.query();
while (fieldSetting.next()) {
var confAttribute = new GlideRecord("ais_configuration_attribute");
confAttribute.addQuery("sys_id", fieldSetting.getValue('attribute'));
confAttribute.query();
if (confAttribute.next()) {
this.saveRecord(confAttribute);
}
this.saveRecord(fieldSetting);
}
},
_addDictionary: function(tableRec, tableName) {
this.saveRecord(tableRec);
var dictionaryID = tableRec.getValue("sys_id");
var dictTerm = new GlideRecord("ais_dictionary_term");
dictTerm.addQuery("dictionary", dictionaryID);
dictTerm.query();
while (dictTerm.next()) {
this.saveRecord(dictTerm);
}
},
/********************* End AI Search Functions *********************/
/********************* Begin Taxonomy Functions *********************/
/* Note: We do not gather SP Pages, Knowledge Categories/Articles, Catalog Categories/Articles, or User Criteria */
_addTaxonomy: function(tableRec, tableName) {
this.saveRecord(tableRec);
var taxonomyID = tableRec.getValue("sys_id");
var topicRec = new GlideRecord("topic");
topicRec.addQuery("taxonomy", taxonomyID);
topicRec.query();
while (topicRec.next()) {
this._addTaxonomyTopic(topicRec, topicRec.getTableName());
}
var taxonomyContributorM2M = new GlideRecord("m2m_taxonomy_contributor");
taxonomyContributorM2M.addQuery("taxonomy", taxonomyID);
taxonomyContributorM2M.query();
while (taxonomyContributorM2M.next()) {
this.saveRecord(taxonomyContributorM2M);
}
},
_addTaxonomyTopic: function(tableRec, tableName) {
this.saveRecord(tableRec);
var topicId = tableRec.getValue("sys_id");
var connectedContentM2M = new GlideRecord("m2m_connected_content");
connectedContentM2M.addQuery("topic", topicId);
connectedContentM2M.query();
while (connectedContentM2M.next()) {
//Add Quick Links
if (connectedContentM2M.getValue('content_type') == '07f4b6bfe754301' + '04cda66ef11e8a9a9') { // valid use of sys_id, avoid scan check findings
var quickLink = connectedContentM2M.quick_link.getRefRecord();
this._addQuickLink(quickLink, quickLink.getTableName());
}
this.saveRecord(connectedContentM2M);
}
var featuredContent = new GlideRecord("featured_content");
featuredContent.addQuery("topic", topicId);
featuredContent.query();
while (featuredContent.next()) {
this.saveRecord(featuredContent);
}
var connectedCategoryM2M = new GlideRecord("m2m_connected_category");
connectedCategoryM2M.addQuery("topic", topicId);
connectedCategoryM2M.query();
while (connectedCategoryM2M.next()) {
this.saveRecord(connectedCategoryM2M);
}
var topicRec = new GlideRecord("topic");
topicRec.addQuery("parent_topic", topicId);
topicRec.query();
while (topicRec.next()) {
this._addTaxonomyTopic(topicRec, topicRec.getTableName());
}
},
_addQuickLink: function(tableRec, tableName) {
if (tableRec.getValue('content_type') == 'external_link') {
var externalLink = tableRec.external_link.getRefRecord();
this.saveRecord(externalLink);
}
this.saveRecord(tableRec);
},
/********************* End Taxonomy Functions *********************/
/********************* Begin Change Management Functions *********************/
_addChangeModel: function(tableRec, tableName) {
this.saveRecord(tableRec);
var recID = tableRec.getValue("sys_id");
var modelState = new GlideRecord("sttrm_state");
modelState.addQuery("sttrm_model", recID);
modelState.query();
while (modelState.next()) {
this._addModelState(modelState, modelState.getTableName());
}
},
_addModelState: function(tableRec, tableName) {
this.saveRecord(tableRec);
var recID = tableRec.getValue("sys_id");
var modelStateTransition = new GlideRecord("sttrm_state_transition");
modelStateTransition.addQuery("from_state", recID);
modelStateTransition.query();
while (modelStateTransition.next()) {
this._addModelStateTransition(modelStateTransition, modelStateTransition.getTableName());
}
},
_addModelStateTransition: function(tableRec, tableName) {
this.saveRecord(tableRec);
var recID = tableRec.getValue("sys_id");
var modelStateTransitionCondition = new GlideRecord("sttrm_transition_condition");
modelStateTransitionCondition.addQuery("sttrm_state_transition", recID);
modelStateTransitionCondition.query();
while (modelStateTransitionCondition.next()) {
this.saveRecord(modelStateTransitionCondition);
}
},
/********************* End Change Management Functions *********************/
/********************* Begin Decision Table Functions *********************/
_addDecisionTable: function(tableRec, tableName) {
this.saveRecord(tableRec);
var recID = tableRec.getValue("sys_id");
var decisionInput = new GlideRecord("sys_decision_input");
decisionInput.addQuery("model", recID);
decisionInput.query();
while (decisionInput.next()) {
this.saveRecord(decisionInput);
}
var decisionTableAnswerTable = tableRec.getValue('answer_table');
var decisionQuestion = new GlideRecord("sys_decision_question");
decisionQuestion.addQuery("decision_table", recID);
decisionQuestion.query();
while (decisionQuestion.next()) {
this.saveRecord(decisionQuestion);
var decisionQuestionAnswer = new GlideRecord(decisionTableAnswerTable);
decisionQuestionAnswer.addQuery("sys_id", decisionQuestion.getValue('answer'));
decisionQuestionAnswer.query();
if (decisionQuestionAnswer.next()) {
this.saveRecord(decisionQuestionAnswer);
}
}
var decisionTableDecisionCondition = new GlideRecord("sn_decision_table_decision_condition");
decisionTableDecisionCondition.addQuery("decision_table", recID);
decisionTableDecisionCondition.query();
while (decisionTableDecisionCondition.next()) {
this.saveRecord(decisionTableDecisionCondition);
}
var dtDocumentation = new GlideRecord("sys_documentation");
dtDocumentation.addQuery("name", "CONTAINS", recID);
dtDocumentation.query();
while (dtDocumentation.next()) {
this.saveRecord(dtDocumentation);
}
var decisionTableRule = new GlideRecord("sn_nb_action_decision_table_rule");
decisionTableRule.addQuery("decision_table", recID);
decisionTableRule.query();
while (decisionTableRule.next()) {
this.saveRecord(decisionTableRule);
var actionTypeDefinition = new GlideRecord("sn_nb_action_type_definition");
actionTypeDefinition.addQuery("sys_id", decisionTableRule.getValue('action_type'));
actionTypeDefinition.query();
if (actionTypeDefinition.next()) {
this.saveRecord(actionTypeDefinition);
}
}
//Enabled by default - only needed if Decision Table results are needed
//Disable if results not needed
//sys_decision_multi_result not needed - captured via answerTable above
/*var decisionMultiResult = new GlideRecord("sys_decision_multi_result");
decisionMultiResult.addQuery("decision_table", recID);
decisionMultiResult.query();
while (decisionMultiResult.next()) {
this.saveRecord(decisionMultiResult);
}*/
var decisionMultiResultElement = new GlideRecord("sys_decision_multi_result_element");
decisionMultiResultElement.addQuery("model", recID);
decisionMultiResultElement.query();
while (decisionMultiResultElement.next()) {
this.saveRecord(decisionMultiResultElement);
var variableValue = new GlideRecord("sys_variable_value");
variableValue.addQuery("document_key", decisionMultiResultElement.getUniqueValue());
variableValue.query();
while (variableValue.next()) {
this.saveRecord(variableValue);
}
}
},
/********************* End Decision Table Functions *********************/
//Add UI Page
_addUIPage: function(record, tableName) {
this.saveRecord(record);
//Add ACLs
if (!record.endpoint.nil()) {
var aclRec = new GlideRecord('sys_security_acl');
aclRec.addQuery("name", record.getValue('endpoint').replace(".do", ""));
aclRec.addQuery("type", "ui_page");
aclRec.query();
while (aclRec.next()) {
this._addACLDependencies(aclRec, aclRec.getTableName());
}
}
},
//Add Script Include
_addScriptInclude: function(record, tableName) {
this.saveRecord(record);
//Add ACLs
if (record.getValue('client_callable') == "1") {
var aclRec = new GlideRecord('sys_security_acl');
aclRec.addQuery("name", record.getValue('name'));
aclRec.addQuery("type", "client_callable_script_include");
aclRec.query();
while (aclRec.next()) {
this._addACLDependencies(aclRec, aclRec.getTableName());
}
}
},
//Add IP Filter Criteria
_addIPFilterCriteria: function(record, tableName) {
this.saveRecord(record);
//Add IP Ranges
var ipRange = new GlideRecord('sys_ip_address_range');
ipRange.addQuery("sys_ip_filter_criteria", record.getUniqueValue());
ipRange.query();
while (ipRange.next()) {
this.saveRecord(ipRange);
}
//Subnets
var subnet = new GlideRecord('sys_ip_address_subnet');
subnet.addQuery("sys_ip_filter_criteria", record.getUniqueValue());
subnet.query();
while (subnet.next()) {
this.saveRecord(subnet);
}
},
// Add Scan Engine Suite
_addScanEngineSuite: function(record, tableName) {
this.saveRecord(record);
//Add Scan Engine Suite 2 Def m2m table
var seDefinition = new GlideRecord('sn_se_definition'); // Add definition if related to suite
var seSuite2DefM2m = new GlideRecord('sn_se_m2m_suite_to_definition');
seSuite2DefM2m.addQuery("scan_engine_suite", record.getUniqueValue());
seSuite2DefM2m.query();
while (seSuite2DefM2m.next()) {
this.saveRecord(seSuite2DefM2m);
if (seDefinition.get('sys_id', seSuite2DefM2m.getValue('scan_engine_definition'))) {
this._addScanEngineDefinition(seDefinition, 'sn_se_definition', false);
}
}
},
// Add Scan Engine Definition
_addScanEngineDefinition: function(record, tableName, doSuites) {
doSuites = (doSuites === false) ? false : true;
this.saveRecord(record);
//Add Scan Engine Applicable table
var seApplicableTable = new GlideRecord('sn_se_applicable_table');
seApplicableTable.addQuery("definition", record.getUniqueValue());
seApplicableTable.query();
while (seApplicableTable.next()) {
this.saveRecord(seApplicableTable);
}
if (doSuites) {
//Add Scan Engine Suite 2 Def m2m table
var scanSuites = [];
var seSuite2Defm2m = new GlideRecord('sn_se_m2m_suite_to_definition');
seSuite2Defm2m.addQuery("scan_engine_definition", record.getUniqueValue());
seSuite2Defm2m.query();
while (seSuite2Defm2m.next()) {
scanSuites.push(seSuite2Defm2m.getValue('scan_engine_suite'));
this.saveRecord(seSuite2Defm2m);
}
//Add Scan Engine Suites
if (scanSuites.length > 0) {
var seSuite = new GlideRecord('sn_se_suite');
seSuite.addEncodedQuery("sys_idIN" + scanSuites.join(','));
seSuite.query();
while (seSuite.next()) {
this.saveRecord(seSuite);
}
}
}
},
/********************* Begin Platform Analytics Dashboard *********************/
_SNunloadDashboard: function(current, tableName) {
/**** Begin ServiceNow-provided code for unloading dashboards ****/
/* Below code provided via the ServiceNow 'Unload Dashboard' UI Action */
try {
var dashboardId = current.sys_id;
// Add current dashboard record
SNC.ContentUnloader.unloadMetadata(current);
//Add Dashboard Tabs
unloadMetadataTable('par_dashboard_tab', dashboardId);
//Add related canvas records
var canvasGR = new GlideRecord('par_dashboard_canvas');
canvasGR.addQuery('dashboard', dashboardId);
canvasGR.query();
while (canvasGR.next()) {
SNC.ContentUnloader.unloadMetadata(canvasGR);
unloadWidgets(canvasGR.getUniqueValue());
unloadWidgetGroups(canvasGR.getUniqueValue());
}
function unloadWidgetGroups(canvasSysId) {
try {
var widgetGroupGR = new GlideRecord('par_dashboard_widget_group');
widgetGroupGR.addQuery('canvas', canvasSysId);
widgetGroupGR.query();
while (widgetGroupGR.next()) {
SNC.ContentUnloader.unloadMetadata(widgetGroupGR);
unloadGroupWidgetMapping(widgetGroupGR.getUniqueValue());
}
} catch (err) {
return;
}
}
function unloadGroupWidgetMapping(groupId) {
try {
var widgetGroupMapGR = new GlideRecord('par_dashboard_widget_group_mapping');
widgetGroupMapGR.addQuery('group', groupId);
widgetGroupMapGR.query();
while (widgetGroupMapGR.next()) {
SNC.ContentUnloader.unloadMetadata(widgetGroupGR);
}
} catch (err) {
return;
}
}
//Add related dashboard visibility
//We won't copy the experience as it is instance specific and shouldn't be coppied between insances
unloadMetadataTable('par_dashboard_visibility', dashboardId);
//Add related filters
unloadNonMetadataTable('par_dashboard_filter', 'dashboard', dashboardId, current.sys_scope);
//Add dashboard metadata
unloadNonMetadataTable('par_dashboard_user_metadata', 'dashboard', dashboardId, current.sys_scope);
//Add related permissions
unloadNonMetadataTable('par_dashboard_permission', 'dashboard', dashboardId, current.sys_scope);
unloadCategoryArtifcats(dashboardId);
} catch (err) {}
function createSysMetadataLink(documentKey, payload, tablename, scope) {
try {
var gr = new GlideRecord('sys_metadata_link');
gr.initialize();
gr.setValue('directory', 'update');
gr.setValue('documentkey', documentKey);
gr.setValue('payload', payload);
gr.setValue('tablename', tablename);
gr.setValue('sys_scope', scope);
var sysID = gr.insert();
// get the GlideRecord
if (gr.get(sysID))
return gr;
return null;
} catch (err) {
return;
}
}
function unloadMetadataTable(table, dashboardId) {
try {
var gr = new GlideRecord(table);
gr.addQuery('dashboard', dashboardId);
gr.query();
while (gr.next())
SNC.ContentUnloader.unloadMetadata(gr);
} catch (err) {
return;
}
}
function unloadNonMetadataTable(table, field, sysId, scope) {
try {
var gr = new GlideRecord(table);
gr.addQuery(field, sysId);
gr.query();
while (gr.next()) {
// create a sys_metadata_link
var sysUpdateGr = new GlideRecord('sys_update_xml');
sysUpdateGr.addQuery('name', table + '_' + gr.getUniqueValue());
sysUpdateGr.query();
if (sysUpdateGr.next()) {
var payload = sysUpdateGr.getValue('payload');
//var sysUpdateXmlScope = sysUpdateGr.getValue('sys_scope');
var linkGR = createSysMetadataLink(gr.getUniqueValue(), payload, table, scope);
if (linkGR != null)
SNC.ContentUnloader.unloadMetadata(linkGR);
sysUpdateGr.deleteRecord();
}
}
} catch (err) {
return
}
}
function unloadWidgets(canvasSysId) {
try {
var widgetGR = new GlideRecord('par_dashboard_widget');
widgetGR.addQuery('canvas', canvasSysId);
widgetGR.query();
while (widgetGR.next()) {
SNC.ContentUnloader.unloadMetadata(widgetGR);
unloadVisualization(widgetGR.getValue('visualization'));
unloadStoredComponent(widgetGR.getValue('stored_component'));
}
} catch (err) {
return
}
}
function unloadVisualization(visualizationSysId) {
try {
var visualizationGR = new GlideRecord('par_visualization');
if (visualizationGR.get(visualizationSysId))
SNC.ContentUnloader.unloadMetadata(visualizationGR);
} catch (err) {
return
}
}
function unloadStoredComponent(storedComponentSysId) {
try {
var parComponentGR = new GlideRecord('par_component');
if (parComponentGR.get(storedComponentSysId)) {
SNC.ContentUnloader.unloadMetadata(parComponentGR);
var table = parComponentGR.sys_class_name;
//Add par_component_permission
if ('par_visualization' == table)
unloadNonMetadataTable('par_visualization_permission', 'component', parComponentGR.getUniqueValue(), parComponentGR.sys_scope);
else if ('par_component_filter' == table)
unloadNonMetadataTable('par_component_filter_permission', 'component', parComponentGR.getUniqueValue(), parComponentGR.sys_scope);
}
} catch (err) {
return
}
}
function unloadCategoryArtifcats(dashboardID) {
try {
var gr = new GlideRecord('analytics_category_m2m');
gr.addQuery('type', 'par_dashboard');
gr.addQuery('artifact_id', dashboardID);
gr.query();
while (gr.next()) {
SNC.ContentUnloader.unloadMetadata(gr);
unloadCategory(gr.getValue('category'));
}
} catch (err) {
return
}
}
function unloadCategory(categoryId) {
try {
var gr = new GlideRecord('analytics_category');
if (!gr.get(categoryId))
return;
SNC.ContentUnloader.unloadMetadata(gr);
} catch (err) {
return
}
}
/**** End ServiceNow code for unloading dashboards ****/
/* Begin ATUS addendums to ServiceNow code */
//Nothing yet!
/* End ATUS addendums to ServiceNow code */
},
/********************* Begin Platform Analytics Dashboard *********************/
type: 'addToUpdateSetUtils'
};]]></script><sys_class_name>sys_script_include</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>2018-10-24 16:31:04</sys_created_on><sys_id>6ba1c8a24f5da740d1676bd18110c79a</sys_id><sys_mod_count>382</sys_mod_count><sys_name>addToUpdateSetUtils</sys_name><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_script_include_6ba1c8a24f5da740d1676bd18110c79a</sys_update_name><sys_updated_by>ben.hollifield</sys_updated_by><sys_updated_on>2026-07-23 19:10:22</sys_updated_on></sys_script_include><sys_es_latest_script action="INSERT_OR_UPDATE"><id>6ba1c8a24f5da740d1676bd18110c79a</id><sys_created_by>ben.hollifield</sys_created_by><sys_created_on>2026-04-10 12:37:58</sys_created_on><sys_id>aca1e06f8740cf9010aa848e8bbb357f</sys_id><sys_mod_count>0</sys_mod_count><sys_updated_by>ben.hollifield</sys_updated_by><sys_updated_on>2026-04-10 12:37:58</sys_updated_on><table>sys_script_include</table><use_es_latest>false</use_es_latest></sys_es_latest_script></record_update>-90215844ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:335dd0e94187d6cb9060bc84c4dabb352f019f9062cecc0000001ben.hollifield2026-07-23 19:10:33
addToUpdateSetUtilsScript Includeglobalaec029c1a51a0f50e6439997f85246aaaec029c1a51a0f50e6439997f85246aa:-90215844,06c029c1081a0f50cff83547f3fb6285:1236546519,fd40a9816c1a0f5081e4db39f6ff3ff5:-90215844,ee1dee5861050f108fff130680c4f9a8:-884240483,de1dee58d7050f101d0da06d5b51f7a2:860258241,86dcaa5802050f103c3ebc37e3d97d5b:-884240483,0a52e9bdd3b8831062e2cadbcf75bab3:-1975187956,cf01edbd71b88310281950d5bcd4c67d:-1572610439,20a1e86f1040cf90ba2ab6830c112afb:1032139310,19b55112129e3a107547daec70612336:1572628226,f8b5159e3e5e3a10d12fb0948ada4955:785588218,097511528e923a109a9a05274365b2ce:1572628226,19a2591ebb5e3a109fd270c834802d9d:-581869807,a8a2591e755e3a10c9774985ff7aafa4:-1551671954,3952911e135e3a105e213ca957dd3bf3:-581869807,a3e01d9af65e3a10bf5d2928242e8b3f:-103307494,27c0199ae05e3a108983831963e81b85:-845103430,405e019a62523a1013bc9fbe0a8e5864:-103307494,b15b45163a5e3a109fc0b5f5b210ef08:-2080546614,415b4516755e3a10bb9dad46c71c0af0:1524417746,213bc116c25e3a1046e1e6b46b63d15d:-2080546614,9898c152675e3a10ca6d8d907bfbc816:-1204088305,f7137fa9671cb21001653c689af63a36:-1711058857,1b137ba9091cb210a4714bfa0e0c68d4:-1074358083,2252fb69ab1cb2109078e325d7849ead:-1711058857,04f59fd87e90369046f3005c75c30a6a:65944821,6fe5dbd87d9036909ac6d834fde97085:627306829,33e3d758ed903690c9f47f8c38ae1b25:65944821,f58f83984610be902b1629997e0703b1:1577381047,778d0bd0f99036905086cf9fe52c0dfb:373057084,5cec4fd01710be90e172bbf820135b47:1970093209,244a43108290369035736e08c8da9155:849084433,03e9c7d0a310be9057d0775d3da5da50:-1797712149,54d98bd0cf10be909403ec71f14470d3:832842125,44598f90f010be903f34f6d247a67a7e:-1353726197,a5580750da10be90c247d2d74f63ddd1:-442319261,c7deea771acc7290ab2c5a38c77995c5:1970093209,a65ee673bfc8fa901795236d530cc1b6:368814096,240e2677decc72902a8ca39170591785:-666636465,f8bd2e37bccc72905167322e1d438cc0:1633895024,25fce2ff5188fa90ee95fae7fbe18888:-281124016,347caaf3decc729032bb43ba6c3097d3:1970093209,b51c62bf1b88fa903794d120b19cde75:1221090578,62faea3f7b88fa903449ed07137f5c4b:810718897,46dae2b3e2cc7290a9a93028e051c1b0:1750466172,33e86633a6cc72907fca7c8f3c253414:502888235,3718ae3bd988fa90e36705d05fe7fc7e:-426396679,cbf7ae3b1188fa904cd9353c4873855d:1668701368,3f67eef70788fa90044453d9c1716eda:-353003080,55f6e6f74188fa90397b4a757fe3db33:2137510520,5086e2b75c88fa90c42cb5194a55d411:-995897928,0d36ea77d088fa90a58a56df7a5799ec:992363479,5106a67f5b8c729006225f914b49d19e:-116416425,0a35663f7a8c7290df3a16898446a553:-942431874,c3e4aef30588fa9000c552f742d8acff:-985732374,43b46efb718c7290a1accc56043e6dc2:-995897928,18b3ae73c288fa901d2e7a2e511b13db:128893508,3c632abb6c8c72904b54692177ac7c57:19326942,a5d26e7b0c8c7290404259a0673887b2:-1723291359,ada22e7bee8c7290e8872c01989a323a:501237954,3be1e6ffc348fa909449827b4dd0eb8b:2007803806,fc51eabf0e48fa902b6625f9ccbfc387:-1114885342,b21d71f7c0c4fa9036c62c012fa7dcd9:-1169742492,2cbb35771fc4fa90daab5202fdcea820:-1433812918,a07aa9b3e184fa905fa9e4b102b550e2:1015593597,ebd9d1331744fa9083015d9ec4a385b1:-217688832,fc85ddbb0b48729028d17ca5737da20c:827187141,bb2cbcbc0d751a106b794e3af0d2c335:34928682,45d512e275966740bde3028c4ca5f079:19324003,fe88bb0a129ae34085e3c790e4ce6db1:1481830973,5a4d37a350fb9a50f1e4eb413f945d94:-270481098,bb2cbcbc0d751a106b794e3af0d2c335:34928682,3b1cb8bc07751a10c2ead61bd9701843:1027210105,51fbf0bcc8751a10e8b03f4e62512f1d:34928682,738b787086fd1a1018b8dd87f2cf7373:939049776,740bbc3c22751a1028bebd3eba9ec59d:1749169702,538ab83c2f751a109f0c3de0fb7821a4:1732608935,986464747d7d1a10c86e1567c28e0b50:-47961403,86bc1fbbfc6156104db0cb0f1ff825d5:1449657553,b53bdfbf8ce91610ed52b4c350886d68:-210771569,3b4853fb71e916103fd8db89bc27f6f6:1499066313,9c31419c7f7a4e50d09390f7dcb97326:714404009,7f21419c907a4e50fafe086ce8bf0a01:2079551926,a621455c657a4e5097905aa29c5513b6:-119851930,1b5e30150a72f5503e83a5e7e8e20f22:-46820869,b65efc9d48f27550a38a555de2b7da46:888640602,dd3e3015d072f550c4627ffade48d51c:-46820869,c63dbc914072f550fdc48f40e72ba616:201877467,96bcf05d81f27550980d30adc18cc86a:1788042588,46bc34918c72f550bd95ed4fbf089952:-1356396291,48fb701daef27550de60c0c43ce8f447:1788042588,3abbb0510f72f550073b2fbb20e14316:-100730500,939bb051a572f550da73bd0ab1349328:1752262396,d98bf8113872f5509b2a28a7366eb523:-1857163842,2d5ab0997df2755071fa7c0e3a09ce94:969922532,e4f9749d8132f550d3bd8bec17c2fd02:-325760434,6d963cd91a32f550aa89fecb44ad1b97:1840697986,3246f4553ef275505f9a2d6b7879ad4d:-710322321,29846638b94e315029cbedc2ed0c85c4:-1088700960,cd84aaf45302b110be91a0e154d5a0cd:668399085,121222748902b1104025fc74afaf1852:-1088700960,0c12ae74424e31507c2b203a16ab3db5:-1903638709,80b12a748d4e315085dbaf052b8bebfb:-1781924099,7481eaf02b02b1105277ea3bc75b9d96:-2063290367,9b406eb0b602b1107b50fb5c14e84338:-523878404,17deda30dd02b1108a3eeeaf1405c954:-1885606884,d45d5270ab4e3150070fdc7eaa7f202c:1821164066,2ae31eb09ece7110e5dd8b0596bddc3f:-1477263975,d9bc2fa8e2c271108a66ade0fe796608:-319262524,ee57c108753d71106cac0ba4303171fc:-1739113187,07c60584a53d7110fe1953cddacd10a4:465632635,5a46c144453d7110a6b8cabb4b869d20:-406862369,4ff4cd805c3d7110dd9d18868753728a:1294677025,f2dd563373957d106eaf3b49174fff93:898081877,5aa7466fc83c6510b21f8bde3ea94a77:-1937323704,2088caa74f83d510eee76e4c37dfa437:586462280,4f9806234bc35910bbbbf8e7e219a6db:586462280,2d39d09afc199110a1f6b75c2979944d:-2062825145,00ee73cd77020910d0ebb0e47f5453de:-665339045,ed772c4d004a3810dcff09b9089fb4ce:1769130092,d1f86e3231a1f050630101eb35f1fe5e:-1121591229,e25c42ca5548701048cdb4a318aa0d57:1106850355,820c820e2f487010d4ea66f9e8e30caa:-1806092378,ea3bca8a69487010b4ba239d3327fd8d:-569148652,51b50ac65f4870102879e4aec521d477:-1262827487,200ff982b34870101fd86de16dfd87a6:-1201418351,47dd75025c48701044ba2d3005753511:641952402,8933cb6ffd94241037e468f47ab8afb8:623534657,469333b3508bdc10e24220c64f74c94c:-431532874,6174baa30bf05410c99fdd8e9723b004:-1230945019,13b1bd09352c5450e10a12207e5e0b70:-1328024929,30d69a2572109c1022a04cd08d9bde85:1920825526,9cd6de69ec505c104be0469f18f31f62:-592264438,3a8652257f109c1039d6939edcecce71:1920825526,11b7f9291e105c10e9327763d5e7f157:-599316008,cf5ee9e54a9c5c1062cdcdd9c03a63cf:-1227254261,7f5ad919e9905c10c15324fa4a590941:865937294,d92a5199ab541c10db46e7985ec63d91:-355613429,c662aa27810cd4109725e65718265ae2:-3610295,1ba447931f670c10fd1c29dd1fc385d2:-1001827771,9c33c7538f670c100d9986c0ba4a4b8c:949334163,25238753d7670c10c16d9af0b361ec26:614944027,d703cb1f7ce30c10156b598b0e14492a:949334163,660387532e670c107e69afe93e48422d:-2012876627,39b2cb1f46e30c1063e691799437ac1c:949334163,ad51c11e606b841051053bc15de15c5a:1030031778,304e745a016b84109c55cc43f496c8e7:889713333,450e7c1aba6b841091c9ec48526a69f3:413998893,0307d87077ab0010308b304eaaa0273b:412830828,1092d03c506b0010504fac927e63b655:-382148721,327686444b61af40db4122e80266e954:1388652866,a3f546440261af4066a63e9b6f553b7a:-860746294,94854ac0c861af400f11d84df120717c:1697316719,24e528bc7a63005077ba9a1ed8ed3e4c:-1196224041,90f7271472abcc509bbd3bf91439b4f4:488447279,fc5fd758f66bcc50aa711e41b42a030d:1410516621,4025f61056e7cc501dc6522d2a2cc914:747548145,56c041fee8d3081028f116d944593a15:-2940014,aa5af4405383401089c009f4a8561a38:-1142586525,045a34403483401088b941acf169d22a:1237848995,c262b08876434010c0a49418b99d7dfa:-1014295823,2632f848df4340107cd3a2135c778d7e:1237848995,89b170087c434010a7887aa7696cf3a0:-2009560566,aaaedc7f4eb2001050f66bc8b80a1a23:1237848995,49b39cf3c8b20010a3704a135753be61:1439481794,4e614104690b041068d41dfb113e90bb:-979170856,ac618dc0c00b0410966a15d0f05d3818:1480025252,7851c540920b0410c40f36eecfe2711a:2136650362,00fb1ceaa0de0010c9213bc2c15e4959:-1316272280,efe4996c91a9841022592300c008e8bc:909846360,f6e4dd68c8a18410d7debff00e216008:1877959279,a1e4996c18a98410067ca9fa67dd6a70:909846360,8f215da4f2a1841009aa003c41cea533:-1542668192,0fef45a896a98410fa33ebb3cde3cd99:1728022254,deef45a885a984102c57e92ac9b31093:537835163,ffdfc5a4c7a18410c569e96658094739:1728022254,d41f14da75d5001036fdc4baea399ec1:-925859695,bc3ad2586651041090e2c17dc8147168:697008358,cdec25bbe3b484d0c20cb2a1b490dae5:-518038221,2ac67de32d3844d07fdb456757424f8e:-706735009,04067de31e3844d08a63af216ac33e69:251981769,56144e3dfb70cc900324e104b642e194:-1860787424,6f310e3dc970cc906fb541ca8c97dccb:497388604,6bbf546ed2dda740d9211f61ce5bdf20:-1631436290,003f146ee4dda740aafb8affa18897c1:-1477791952,e8ce982e81dda74056a4c8c991135571:-1820867515,46dd18ea11dda740a245735d0dbdac99:-1062975483,25cc582abcdda7402c98ae2c1cd00d33:1011783724,ef2cd86acfdda74008cfe8e673b14949:1628907996,eb2b182afddda740806ca7ac99caeedb:257180406,410b5ce6a6dda740b02a4b190dbe0ee7:-538906101,d15a58e610dda74098c6c72fe8832661:-739469094,95a6502644dda740376e95fa01d94b67:-1263950745,90a35cae1b9da7406d78dc07a6af72fe:-1379355448,0e21906ee19da7404d5f5c8b7cd69bae:2034912539,13aa4426379da7403bf86da1a5b2d865:-1081349912,45d780aa585da74068ecefe0ff8eb9eb:-801395497,afd6846abd5da7409d0ac104261077d2:1225160055,dea2c8a2775da74075beac333d875eae:1738992248,9e5ba17fb3b00c10a0dabe2414661c48:-518038221,b60a617727b00c10deac479932a3ef51:1466077613,8ae025b3b0b00c10dc7253153c9af018:2074557600,2c24d1fbe3700c107e16f5e7ff4d50ee:1925151395,74211d3bb3700c10e6bcfb13b1cabf68:-513621060,1490953b8d700c10c08d6de50001eb97:1635026018,6230913bc3700c10ec7c8a72852cdd0f:-56956622,ce0fc1f75a700c10190b5a1cdbdb048d:-2139941155,f693b5a7f0b4c810c3686d2b35d98f27:251981769,05027dab54b4c810820f3f3b35c34f2b:1643472022,fecfe1efea74c810c66fee6f0b7d5140:-237179119,081a65a76db4c810d61d503376fc5aed:546288913,7729ed637bb4c81014cb3263b4b502fe:-475807438,6690e1ef7274c81077ededa0deb5e615:-68168798,a46f59abec74c810c65768022990f0f2:1247948312,37aa59ab3474c810370110af7fc223e8:1542575244,19a5f896ed70c4106a119525f14449c7:2046146765,c4a2c6bdda3084100bdc9085eb5e0b04:-1860787424,d33ec32d46b44410d28e6e945e2e7f2b:497388604,796d42adb6f044109e34e83549f35c6f:-46642814,23ecce6df9f0441098cf814d17deaa09:1605866508,48cc0a6d24f044102223a4416802bcf9:1031640214,ab4cc66da4f04410e99d36254f89ab40:-1967006218,876bc62d4df04410f7d6ad6eaf53b64d:-1388402566,b0ada5a98470441015d99fb7e5d81358:353976378,48db2169857044101bac2c276d96b92e:-1513309651,305be129c2704410a8e0928d10b71bc6:-1301708338,fb7a2129647044105304e68515ac59fb:-40805808,671aa9a586704410b8cadd6527da67bf:1253580744,6b072525c17044103f4e1160bcfb039d:1363739251,d066a525ca7044100ee89ec9a4910bc0:-752214353,94c5a525ca7044104435c0dd66c2ddba:-1909954049,f895e5a1ca7044106cdc21bb61af88b8:-1996944769,ff04ed21f9704410744f9caac73e9e09:-2132236902,ab21e9ed1c304410b2377c369a39e4d7:641223050,198f99e582304410e9aa8f8bf7313067:-1469593875,97f31da5833044103fe43eac85b4fb53:-855843798,41d35125b23044104c68b86edada208f:-844456857,5be2dde1b63044105efed975bc69fa8a:1101802954,12e38f23ade48c505c3f12190cbb3a21:1471879314,f3d86e6f13648c50151f8049955e82a1:748669682,0638a66fba648c5054562a4c0cb635c7:1991167005,97b7266f60648c500bf49a0abf180de9:1430303841,05372e2f1a648c5087d28cc96f11d162:-1295709554,59e6ea27c8604090d7d42d7bd652bbe5:-1074029812,1e3ad903fae80c50c940b2d74deb5f16:-1986021846,538895cf17a80c5062cc9fa406f8dd11:-1660476975,9e08914ff7a80c50525e4831ce7cede7:967319335,b6971d8fd6a80c50e623e6667864eed3:4827847,d077514f1ca80c50e60b4bb431024496:-329995484,dc95514f38a80c508ef09963be947565:-52745440,ae75514f9aa80c504a488d15c839be5e:-887434672,f6051d0f91a80c50f0bfe449ff1c5808:497725961,bac4d50f16a80c50d855d68ab59a4b7d:411882128,dda4d50fbda80c5037d3453d89da5675:-1708993716,2a84d5cbada80c505c1ead85b89537f5:1184357686,7364150f41a80c509191821c7d6c6706:552977014,fe54d10fbda80c50df54db8a7d5a28b7:903038476,f8b251cb75a80c50ed96bcfdb6712006:-1159889403,0e825d4b96a80c50994dc36f013ecbb3:-1972031771,c2e19d0bbda80c50447ef6f71b8b026b:-657975829,6aa09d0bbfa80c5062dad1fba6c5c09a:1675377445,8b009d0bc7a80c508c943b08cb50d195:1940947445,2dbf8d0b03a80c508e51593e9bbb9c60:-1991394603,869fc50b86a80c50a2edf4604c2aee41:1533289182,b63f450b4fa80c50c1cf03955f9669da:-1885307889,590fcdc79da80c508cdc61a85d2ed3df:-516433450,3c8ecdc705a80c505614100a53dcf8cf:-465983727,c15e89c765a80c50fb10d983ccfbd65f:-2040757945,94fdc5c766a80c501f881096289dc7a7:860866493,66260903eba80c5077f32d2f56e713e9:656839963,37e409038ea80c5063532ad3a41e2ce1:1284285563,ec8445cfd5680c50c540f0915166196a:-1397413961,7043c5cf5a680c505073d749e8d8aa0e:1384245061,852385cf9a680c509b2d53504f2cf7fc:1320453050,caf28d8ffe680c50481528424fb9b9dc:617102975,c2728d8fed680c50a0dd97c75cdc70d4:-529731083,f622c98f6a680c50e04e321e9e5a410a:43912444,d202c18fb5680c50d4123bb678654c34:1758563752,dfd1c58f9b680c50ee28b7e1c81a3270:-1897683256,2d81c18f54680c50be8d76f586c15e29:1758563752,8447348712680c50a9f0b2a03c79246d:-1033999349,39073487dc680c503f7113e0987b0543:1758563752,2b963087bd680c50d9d5c8dac2355130:1103494429,3a66b847cb680c50022d011d667d6d84:1015242886,f82638474c680c50732fd094252d6230:-264405591,80f538477c680c50529f29999b00f205:-1202652461,a3957047d3680c505ad25514d5ce350e:78090940,be557c0738680c50e851ba54f0755d1d:728386574,6605f00734680c50a2ef16179255d127:-411340595,7a14b8c37c680c5005d88f0c6d459a6b:-746242928,3a93b8c32c680c50ff2249acbdb95763:-1198906289,ef7338c3f5680c5018f68ad31e8ca9ed:-1194369498,424370c3ea680c50653520cae27baaa2:-383146511,2ce270c3dc680c509b96665113967f8b:1383322687,e7a23483e7680c507b7f1c606d571895:1004423459,0b717c43ba680c50af14adc243888ebb:-605831725,16213c4338680c501aa1191f0f68236b:-623482980,77907c0356680c509e6cda8844dee8b6:647036941,39007c031f680c501d523b61b8014166:-2031660915,768fe8cf1b280c507aea3baf7c57947c:-1186843645,c57e2c4fc5280c50808919c1c1a4e33e:-2107869729,01dbe04f63280c505c83caf431ad82a0:-529964182,b72ba04f0e280c501a6a0d135b82df4b:-1996954935,1bfa204f40280c50c9750537f7d972e9:-1495766179,d9f9a00ff3280c502186012d7d8812cf:1709836484,e3c964cbf6280c50011a46325b240cbd:-1998234963,371968cbe2280c50e99f0c0d5f30a1b0:750205336,0dc864cb1c280c50d1e00fb15a6d8f2b:-378036309,09a364c715280c50b2e52bb0fe39c6e6:-1246045824,7133e0c7b9280c502cee8ab83a1bebe4:-1630246878,63f2e08779280c50628b8b83786d8ec1:-570382891,d1416c47e4280c503332932b93e0d5f6:-805824427,efdfd0c329280c5082e6ffd7d1a4473f:-1779693801,e3addc8340280c505d6488ab2133c0a1:-525361682,607cd84339280c506503f2a3cd988cbc:-943481322,01db500374280c50f0c0a82a39aaeefb:1644134113,1a39d8cfc1e40c50118108dd4840d880:-220139590,011998cfb5e40c50b8e2d12173f9bb9c:1316715866,3227908f3ce40c5089e77c120e4d14a8:-1066155012,b9d69c0f32e40c50177fe746dd2b2fb9:-464823965,99859c0f52e40c500bf410beea61f2a6:1319689676,083dbff6fca40c5057e9dfc29ecf14be:2011631677,b14b948666ec0090990a08da0d66e4f7:-1033999349,4ecac8354d2c04500a97e5775d774ff2:820808323,46e9c0fd41e80450f787642c6bc6a318:233752525,a820403d9ce80450601732cf27b29654:-781888401,6d5d06cfc5948450c965e55be25d8d36:-1413095855,0bdb42cf269484502ef786d0b2bdf7e7:-746786914,a69222a09ad44c10d744432707db6a29:-1835579754,f550666077d44c102654d82253b0fee5:1041712096,5450a66055d44c10ea835288be23db7a:-1928124656,e210ae2025d44c108c4f32005c2c3491:1041712096,fde6081b2a440810b366c9b397565d1b:-802252128,ef1020f05344c850eb9368562959b779:-847324184,23df1074a944c85089e286611b72f1ab:578608324,eaad10f0a244c850e1258d8b76316373:517261412,b8275c3c5a04c850a1c663de3c476111:-368931298,98c6c8893dafb300cfc30e55802be179:2075972173,b61c05875f9f33800fd543acc75b9940:-1081624829,8300ff0ba483f3400f653f6c1b0a7f42:1111618574,1108be434a03f340f1d861f03c4a203a:861995829,ff66c2eedb837340e4033404abfaaeab:406017696,de6646ee0683734070a282c117fd61c1:1792566144,3446caae328373405e058930fe2acac6:406017696,265f75aee943734010b93fee99f48acf:1864941856,b731b12e4e4373404a1be45a2853159f:1409608316,45faaca6f36a73009df6b16029d6e42f:-1052401614,357aa066876a73007093d3b1f9937a33:-1205423473,bee6d2f5d6a2bb00dc0ffbd36e67726b:1763169198,8c4475699fe63b00c280a05672b62cc4:643782091,45d46d552d623b00d77ba814558fa148:601708978,db601be86392ff0098e4d0a4c88c2a68:-530264768,ad609fe88192ff00be9d315786048ac4:-2044025515,8eef4368b292ff00a5b7615d0ca6ad40:-530264768,8ad335ba2c463b00562c38c275f3fb29:-1119542109,8f437db23c86f7004cfe2747cef930ea:-30337017,7eb51064fea173801ee01c86d141daa0:1651993921,e91050ec8d617380dad22320eedd85bb:1710395530,42872c46726848503df13a142009d955:1442411258,0d96e046f96848504e3b09562c131b74:-1147068168,29f5e80618684850be34f0e31451437b:-595962564,f46f880e796cc8502a6d4f54d92ee979:-1033999349,e31ecc8a926cc850fa0136a511c14609:277318789,266d4c8a3d6cc850b57c01ae07d70050:786814847,f74d4c8a736cc8509f941de41947192c:-1746066644,491d888ade6cc8509bee6bb2bd2f8505:786814847,5d119769c16c88509b00587a6ff62e44:-781888401,b24847e1cd6c88501395a5e84ff00433:806211583,57efe6c537a04850de2ed5babc604cfd:-1640248865,861da2093aa04850b20ffc83b407ccf0:-1120788747,1bfb6e853ca04850c5b8e89d8eb65e32:-311437572,980ba6855ba04850ed2f6a378ed1045b:-609115876,c328e20554a048508bc71a505c1d7f05:-1069151327,808722c10da0485061e52dffce87cd15:-1944681115,8fe5a68135a04850a19f467ed6acf7d0:-2102361564,89d06a8d74604850058971681c2e0954:380844639,e8ccca4f209040507b6c97084094a449:-1413095855,9a7262a4ca5c881099c452fae9650a21:-1835579754,08a756e8491c881000c23abef5054e1b:1041712096,80a49668541c8810a5ccba4c224aff20:309016029,3d239268271c88101177b2cbdeee4a1d:103676982,6ad29e28c81c8810866866ff85f34bf7:-844307658,2cb2da28271c8810bd7459f8af8e8882:78643348,95625628751c8810d6355b8986236b94:603705510,1cc1dae4e41c8810f82df5e2665aa88b:-1457980120,c95116e4271c8810d01c81074d10761c:935104167,35c056687ed88810c93a494318097902:-1580571826,a4fa85ac7c188810e68a1ef8aad27a1e:-861975439,11ba8d6c021888106e633aa55d97d231:47450459,806a856c8c188810b856630b47c49625:254047830,051a4d2cff18881038833c03d84d9257:-1698097966,913841e8be1888102903aeace87e1717:191339348,e05e78602a188810d274e6d6968e7b8c:-5438133,8a7d70603b188810d888bdd6a14093d5:-1766151003,3e26fc28bbd488101f9555bd33e61407:-5438133,7b5980d017184810ed8903ba290bceac:154738257,68c6c4903a184810cdbba6b890182a9e:-1819252569,4b364490cf184810e036268689570d47:-247683171,1806489800d44810038dc88ab7d46628:-1132936785,042c778811d44810eb5bb02539c034db:278019415,a1fb33885ad44810e178c4ac5ebdff7c:380068283,a52b774896d4481037775417302e90b2:1990955315,91e6a16a2c4cc010d7ca9f8cc865cad2:-802252128,2af3959eae00c01099a6a3e34e426e47:-205128059,2963155e0b00c0105915b0ebef365bce:-687606587,8ff2191e9b00c01057d6dfd54ace9603:-1287398412,8e5f947c900c48104cfab7f120a5924c:578608324,bdcd103414404810ca0e23244b8aeb7d:517261412,3f795b20bb8c081081f2e1b9db33a270:-368931298,42dc4ba4fd4c081021934bd01e3753cb:1993392365,92bc72e87a0c081046a7151328bb0a14:-1783588603,554af2d024c80810a12c88e60c8c0901:572930529,abf5fadcba880810ab927775f346129b:861359570,52e532dc9c880810e6511c3135096bbd:-1590165229,7625be5c078808107b04252d98abab57:115681914,13e4fa9cf388081068712a5d62c45c87:-1326105914,a2c3365c6b880810fd1ce42d0f0b6cb9:1317227498,f0a3365cdb880810c4f792886124b0ac:1933798011,d613b25cba8808100b45984eee30721c:-1985143416,64f2b25cdf880810113ab6d8e7964214:1877267756,eb823e1c3b8808103def44754e73ba25:-1611110784,5022b61ce3880810b1fa9043351828f2:1811086501,3e71b6d8cc880810af1533d880ac9946:-404308306,70b032d8ab880810e5c4a97cc3ea2c86:1854711276,4d80fe9895880810fd9db875c43a6b9c:-232576217,8e40fa982888081057b6fb23ad0742b7:1010189947,d5ef2698be880810219fa45b1de48d23:-753663282,65bfa298898808108e974cb0f57a09c4:552498889,4c5f2298e9880810e063f6cfd96097a5:1425479623,222f2e5858880810ac971f186403f8d6:-1042860355,21fe2e58518808104a6bdc297dd44a56:1310516593,fc8e6e1800880810538c9e2c90a4eb10:-661283399,f6ed6e18a88808108b9bf81b26b4005b:-728522382,9d6da294ec8808108cfc49efc698bcaf:413508626,bb796654da880810246b6e2cd52641a9:-576525037,5a49e254ca880810bb4a7ba05c68a9f1:-1833202518,f4092e14d4880810ec806480a12584c6:-233672089,fac86a14b08808105e3636c2ab93418b:-19941780,8ab86a143b8808105908eef85544d384:-489928094,d38826d03f880810e653f363e200c172:-780830317,04d62e9089880810d2517ccd3a582a28:-1430300634,dff52e50368808101afc9207da79253f:-97077678,4295ea506a8808106da90f8852aa114d:-1460943393,7e35ee1004880810f1b3af0be2d1819c:1121313514,bfb4ee1052880810cceafb8d250ece96:649742919,1b046a9406480810b2855de2b906c36b:11264318,38e266dc64480810a8b9f0d7e947d0be:362992247,c6185694d9480810ec17fc70f636ac5e:-44185472,d0c75a54ef48081094d37633b1dea12d:-1912355490,9df61a544f480810ea4952b9b102f485:-1789433079,ccf15a103d480810236d4436dee78166:-234584795,daf01a1032480810abd0573cfa1df69c:-1531289998,8e1056dce4080810b3fc0746e7d81d7f:-838550580,cadf4adc1c080810679372fbe6e4451d:-984856363,208f06dc6a0808107ba9c7f0db6157ca:-367921298,2b4f42dc2508081094ed5750bb24aeae:-342497596,3b3982981d0808109d29463e8e1df842:-1511981598,c7198e582a0808109788b599c8012661:-523607312,bbd8ca58240808106407be6af729da73:1237787830,f5a80658010808103ca1af8e582b5b78:1402571012,16a7421856080810c04d7f1e6dd3c183:819261956,5dd44489cbab7300bab3232706a78ee6:2075972173,e39300c521ab7300e112a8deb3dff730:-1802690581,00b8f88bc91f3f009d8dda73770143ad:-1081624829,a8c4b087bf1f3f003e0d0c12d36433d7:-1604809025,48ecac8f79db3f0067affc18c75736ff:-1081624829,b1bc648f33db3f00d36ac2c0e5a3b141:-1510348560,c7e7a84b92db3f00421c370b56881c03:-1081624829,8c8f884f631bfb40d209dcb85d6400c4:-1510348560,2bcfeb8fd90b7300da79a2b4e7ef24be:1111618574,8b9e2f4f450b7300ebeff3711474f0c2:-1221243379,89ab63cb480b73001a8b1b64acd086ef:1541182739,1c431b0bcdc77300558e5a8e0720cf98:1111570012,20f01b872cc7730039f447f9a8b36c79:485922556,9150df47ecc7730068ab2b457c38aa5f:1111570012,ee3b8743cbc7730041866a5c8de66008:-2028062062,d9f9870306c773004333fe0561504bb9:861995829,25948eeeb10f7f00877ae1406856240f:406017696,b1b3c6ae440f7f00bd910b67198f7a4b:228419205,174282e650837f0003a8ad9ced168f93:-369590095,68d142e6b7837f0096341a59fa1891db:-248979307,de11c2a65d837f008cbef79c9e01a55d:166198048,e33ffdaa270f7f00f1260e300b56e452:1864941856,4fa8f9ae27437f00b46fad84b8d8e594:1079926924,2c16342a0a8f3f00a103719515d0864a:1409608316,921534ae7e0b7f0087471dfa1b0d3590:1277593886,e3f170a6e78f3f00dcb6122de285bd3d:-435484908,e8efa4aa670b7f00fb779b88720edfd9:-1248945972,d3842caeddc77f000b0ff088193e3fe4:2040946654,c469ff9aa7cb3f008be8d80101f23112:-548589888,9ef6f096d20f3f00d49e21393a082596:1543424016,5866b856a00f3f00a849529052e4c643:-780531744,2ad4b016cb0f3f00f05b8b82d47bca43:176911514,0684f8de03cb3f0071636c1238911fbe:-1665263430,070f20dea0cb3f006341c3f6a6a936d2:1610070119,53fd689e6bcb3f00ca169b26119cf582:-1225280305,f1fce05eb5cb3f00eb0f6b4e7b025f93:-922064541,56fb601eeacb3f00b72757246b796206:-1742792165,484ae0dae7cb3f00ef68b57945ff8d88:1510837746,aa68285af3cb3f003d3fabb81291fc85:-185122397,d6d8c41e7f4b3f00375babed2616cd0e:-1880427266INSERT_OR_UPDATEglobalcustomersys_properties_80067a902fe7cc50c6c690bcf699b669Add user records and dependencies when adding Groups (sys_user_group). This includes the group manager and all the group members and child group members. Set this property to 'No' to exclude them. (Default = No)falsefalseaddToUpdateSetUtils.group.add_userssys_propertiesadmin2020-03-10 18:39:4580067a902fe7cc50c6c690bcf699b6699addToUpdateSetUtils.group.add_usersglobalglobalsys_properties_80067a902fe7cc50c6c690bcf699b669admin2020-03-11 20:54:18booleanfalse]]>949790249ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:3391d0e94187d6cb9060bc84c4dabb352b0199780dc7da0000001ben.hollifield2026-07-23 19:10:33
addToUpdateSetUtils.group.add_usersSystem Propertyglobal543064b077eb0010298ac0f95e130874543064b077eb0010298ac0f95e130874:949790249,e34edbbfffbed650fc57c696680df05f:1068645407,543064b077eb0010298ac0f95e130874:949790249,ac8f90309beb001094b185faa4d75205:1360701350,933e943c93ab0010a5807ed00b5822b3:949790249,185d10f890ab0010da6fc8ea34a1d745:144666466,d813d4bcf96b001033cf91940c85900d:113165679,8fd2187cfe6b00103934e0314d98a8ab:930890112,2293acac5b6fcc505485e9d2a34d78de:113165679,fe42a82cf06fcc509112aadc1c810d23:-525514941,2ed6ab90caabcc5057ba181ae6cf0222:-306930719,84d73a50f0e7cc509f55a5d2a43593ab:792803662INSERT_OR_UPDATEglobalcustomersys_ui_action_131e99ed49e8950002ad45cc9609026f<?xml version="1.0" encoding="UTF-8"?><record_update sys_domain="global" table="sys_ui_action"><sys_ui_action action="INSERT_OR_UPDATE"><action_name>add_update_set</action_name><active>true</active><client>false</client><client_script_v2><![CDATA[function onClick(g_form) {
}]]></client_script_v2><comments/><condition>gs.hasRole('admin') && new global.addToUpdateSetUtils().checkDisplayCondition(current)</condition><form_action>true</form_action><form_button>false</form_button><form_button_v2>false</form_button_v2><form_context_menu>false</form_context_menu><form_link>true</form_link><form_menu_button_v2>false</form_menu_button_v2><form_style/><hint/><isolate_script>false</isolate_script><list_action>true</list_action><list_banner_button>false</list_banner_button><list_button>false</list_button><list_choice>true</list_choice><list_context_menu>false</list_context_menu><list_link>false</list_link><list_save_with_form_button>false</list_save_with_form_button><list_style/><name>Add to Update Set</name><onclick/><order>100</order><script><![CDATA[new global.addToUpdateSetUtils().addToUpdateSet(current);
//Get current URL for return
var url = GlideSession.get().getStack().bottom();
action.setRedirectURL(url);]]></script><show_insert>false</show_insert><show_multiple_update>false</show_multiple_update><show_query>false</show_query><show_update>true</show_update><sys_class_name>sys_ui_action</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>2013-10-21 00:09:52</sys_created_on><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>131e99ed49e8950002ad45cc9609026f</sys_id><sys_mod_count>38</sys_mod_count><sys_name>Add to Update Set</sys_name><sys_overrides/><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_ui_action_131e99ed49e8950002ad45cc9609026f</sys_update_name><sys_updated_by>admin</sys_updated_by><sys_updated_on>2020-03-16 14:44:09</sys_updated_on><table>global</table><ui11_compatible>false</ui11_compatible><ui16_compatible>false</ui16_compatible></sys_ui_action></record_update>88749032ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:3391d0e94187d6cb9060bc84c4dabb35300199780dc7e60000001ben.hollifield2026-07-23 19:10:33
global
Add to Update SetUI Actionglobalbe6bb4569a6b8410ab30acaa20c8e912be6bb4569a6b8410ab30acaa20c8e912:88749032,5a2dbf63ecfb9a509ae84065f4abfbf7:-1984427663,915e1fbfa0bed6503f673e4714126476:-1992503427,be6bb4569a6b8410ab30acaa20c8e912:88749032,de0bec1a7dcf08103b1466846f3a57d6:-119784934,c5ff6c3cc46d238096008c21e1070527:-2146403617,c5ff6c3cc46d238096008c21e1070527:-2146403617,d3ce07d8c9a5ef407c8a7d3a1dd47890:-2146403617,601e4798e2a5ef40550717761b67086a:1961279972,1ecdc68c3061af40bc73ef79b0489fb3:-2146403617,7f2c8ac84961af401dedeb763015b13a:790623246,a8ea0e480361af40431265928e3711fa:1777631246,92f88c6e3a5da74083f8941a446e92c2:351826716,3f788c6e915da7409eb8511a7af8b773:1672783214,4de0ba3abb640c1029d1bdaeed1e21d2:842632804INSERT_OR_UPDATEglobalcustomersys_properties_c3cd78162f6b8410c6c690bcf699b612List of specific admin users that have access to the Add to Update Set UI Action; leave blank to allow for all users with the admin role. Set this property to a Comma-separated list of User IDs (sys_user table user_name field). (Default = blank, all users with admin role have access to the UI Action)falsefalseaddToUpdateSetUtils.specific_userssys_propertiesadmin2020-03-16 14:54:32c3cd78162f6b8410c6c690bcf699b6125addToUpdateSetUtils.specific_usersglobalglobalsys_properties_c3cd78162f6b8410c6c690bcf699b612ben.hollifield2020-03-17 00:41:13string]]>1783637555ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:3395d0e94187d6cb9060bc84c4dabb352c0199780dc7ec0000001ben.hollifield2026-07-23 19:10:33
addToUpdateSetUtils.suppress_photo_attachments.addToUpdateSetUtilsCategory Propertyglobal63020f1378670c10e48814392c8c16b763020f1378670c10e48814392c8c16b7:1719673204,63020f1378670c10e48814392c8c16b7:1719673204INSERT_OR_UPDATEglobalcustomersys_properties_36ce97182f6bcc50c6c690bcf699b605Prevent the addition of NLU models that are flagged as protected - These include out-of-box NLU models and those provided via the ServiceNow Store. Set this property to 'No' to allow that to happen. (Default = Yes)falsefalseaddToUpdateSetUtils.prevent_protected_nlu_modelssys_propertiesadmin2020-03-10 21:30:0536ce97182f6bcc50c6c690bcf699b6055addToUpdateSetUtils.prevent_protected_nlu_modelsglobalglobalsys_properties_36ce97182f6bcc50c6c690bcf699b605admin2020-03-11 02:35:47booleantrue]]>-1502416975ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:33d1d0e94187d6cb9060bc84c4dabb352a0199780dc7ca0000001ben.hollifield2026-07-23 19:10:33
addToUpdateSetUtils.include_attachments.addToUpdateSetUtilsCategory Propertyglobal127f5030d8eb0010cec48d420bd7484d127f5030d8eb0010cec48d420bd7484d:-758317582,127f5030d8eb0010cec48d420bd7484d:-758317582,61fd5fd4236bcc5024c5ac436a9114e0:-758317582INSERT_OR_UPDATEglobalcustomersys_properties_9e7e5fd42f6bcc50c6c690bcf699b6e1Prevent the addition of items to the system "default" update sets. Set this property to 'No' to allow that to happen. (Default = Yes)falsefalseaddToUpdateSetUtils.prevent_default_updatesetssys_propertiesadmin2020-03-10 21:28:429e7e5fd42f6bcc50c6c690bcf699b6e110addToUpdateSetUtils.prevent_default_updatesetsglobalglobalsys_properties_9e7e5fd42f6bcc50c6c690bcf699b6e1admin2020-03-11 19:55:33booleantrue]]>-894199856ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:33d5d0e94187d6cb9060bc84c4dabb352b0199780dc7c30000001ben.hollifield2026-07-23 19:10:33
addToUpdateSetUtils.prevent_default_updatesetsSystem Propertyglobal549f5430b2eb00102d6297951532e544549f5430b2eb00102d6297951532e544:-894199856,805edbbf68bed650c29ec5b9781ebcb9:329846086,549f5430b2eb00102d6297951532e544:-894199856,bbb25c7ce56b0010b3253a17328d18a5:-894199856,78a2187cb56b0010e878d3d0408979e4:-232670401,3f852c60fcafcc508f815f3e60ba8332:-894199856,3935e42041afcc500bfe95374f30d41c:-232670401,38c4a8207cafcc50bcd941df4b400bd6:-894199856,7e942020efafcc50cb69c22840b84b13:-232670401,63a3a0ecb06fcc5047257e97e63bb113:-511867110,735368acb66fcc50bb26c0e036d3984f:-1109646096,502360ac336fcc5033760dc34e47be10:654746797,45a2e06ce46fcc504304a070dc945d17:-34289502,7a7e5fd4976bcc505b6d7789640e0de5:438521917INSERT_OR_UPDATEglobalcustomersys_properties_category_cdf73a142fe7cc50c6c690bcf699b6a2<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_properties_category"><sys_properties_category action="INSERT_OR_UPDATE"><name>addToUpdateSetUtils</name><sys_class_name>sys_properties_category</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>2020-03-10 18:40:31</sys_created_on><sys_id>cdf73a142fe7cc50c6c690bcf699b6a2</sys_id><sys_mod_count>4</sys_mod_count><sys_name>addToUpdateSetUtils</sys_name><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_properties_category_cdf73a142fe7cc50c6c690bcf699b6a2</sys_update_name><sys_updated_by>admin</sys_updated_by><sys_updated_on>2020-03-11 20:49:14</sys_updated_on><title><![CDATA[<p>Preferences for the Add to Update Set Utility. <a title="Please check Share for updates" href="https://developer.servicenow.com/app.do#!/share/contents/9824957_add_to_update_set_utility?t=PRODUCT_DETAILS" target="_blank" rel="noopener noreferrer nofollow">Please check Share for updates</a>!</p>]]></title></sys_properties_category><sys_translated_text action="delete_multiple" query="documentkey=cdf73a142fe7cc50c6c690bcf699b6a2"/></record_update>-940913559ddd0e94187d6cb9060bc84c4dabb3528falseben.hollifield2026-07-23 19:10:33d9d0e94187d6cb9060bc84c4dabb352c0199780dc7a50000001ben.hollifield2026-07-23 19:10:33
addToUpdateSetUtils.exclude_tables.addToUpdateSetUtilsCategory Propertyglobal92c6460a2e487010cdef28cd5c87efd492c6460a2e487010cdef28cd5c87efd4:626575937,92c6460a2e487010cdef28cd5c87efd4:626575937,68120f134d670c1057940abea69d9bbe:1896192128,335afc16c16b84104076a6169b5e5f77:-1129158977,335afc16c16b84104076a6169b5e5f77:-1129158977,07e838d2ac6b84103c6e49c3dc866e63:-1129158977
----
=====UserLog Complete Update Set=====
JWJ0215 01/08/25.
This update set is to install the 'User Log' for the 'Debug Now' button to be used in the sysauto_script s.
Once this is installed, you will want to add the log (u_log) to the favorites and then add the u_log.LIST to favorites
globalGlobalglobalJWJ-User Log Complete-2025 MAIN9bfb88ec97c35a9035e97666f053afc5loadedsys_remote_update_setjwj02152025-01-08 18:09:286cfe846497075a9035e97666f053afa70jwj02152025-01-08 18:09:28INSERT_OR_UPDATEglobalcustomersys_documentation_u_log_u_string1_enu_string1enu_logV1ssys_documentationggb09262023-08-31 20:13:4338d65e749705f1103e1432890353af190V1globalglobalsys_documentation_u_log_u_string1_enggb09262023-08-31 20:13:43]]>10846155976cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:2820fe8ca497075a9035e97666f053afa00194471a4b2f0000001jwj02152025-01-08 18:09:28
u_log
User Log.V1Field Labelglobal9eae84a4a2075a90c27e8ed5fae761329eae84a4a2075a90c27e8ed5fae76132:1084615597,fcd65e747205f11041400660f1bea157:1084615597INSERT_OR_UPDATEglobalcustomersys_security_acl_bcd61e749705f1103e1432890353afc6truetruefalseDefault access control on u_logLocalu_logdeletesys_security_aclggb09262023-08-31 20:13:43bcd61e749705f1103e1432890353afc60u_logglobalglobalsys_security_acl_bcd61e749705f1103e1432890353afc6ggb09262023-08-31 20:13:43record]]>-9834516866cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:2820fe8ca497075a9035e97666f053afa30194471a4e840000001jwj02152025-01-08 18:09:28
User Log.V0Field Labelglobal9aae84a421075a9064702214b0db1e2e9aae84a421075a9064702214b0db1e2e:1424888687,fcd65e743305f1107b82da41f161e453:1424888687INSERT_OR_UPDATEglobalcustomersys_security_acl_28d61e749705f1103e1432890353af8atruetruefalseDefault access control on u_logLocalu_logcreatesys_security_aclggb09262023-08-31 20:13:4328d61e749705f1103e1432890353af8a0u_logglobalglobalsys_security_acl_28d61e749705f1103e1432890353af8aggb09262023-08-31 20:13:43record]]>5466457526cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:286cfe8ca497075a9035e97666f053afa20194471a4cbc0000001jwj02152025-01-08 18:09:28
u_log
u_logAccess Controlglobal9aae84a475075a9067671f1f422eb9779aae84a475075a9067671f1f422eb977:546645752,883d6aae95f10a94859fdf27cbf8bbae:546645752,2cd61e746405f110f40e390ad182df8d:-896814798INSERT_OR_UPDATEglobalcustomersys_dictionary_u_log_u_string1<?xml version="1.0" encoding="UTF-8"?><record_update><sys_dictionary action="INSERT_OR_UPDATE" element="u_string1" table="u_log"><active>true</active><array>false</array><attributes/><audit>false</audit><calculation><![CDATA[(function calculatedFieldValue(current) {
// Add your code here
return ''; // return the calculated value
})(current);]]></calculation><choice/><choice_field/><choice_table/><column_label>V1</column_label><comments/><create_roles/><default_value/><defaultsort/><delete_roles/><dependent/><dependent_on_field/><display>false</display><dynamic_creation>false</dynamic_creation><dynamic_creation_script/><dynamic_default_value/><dynamic_ref_qual/><element>u_string1</element><element_reference>false</element_reference><foreign_database/><formula/><function_definition/><function_field>false</function_field><internal_type display_value="String">string</internal_type><mandatory>false</mandatory><max_length>4000</max_length><name>u_log</name><next_element/><primary>false</primary><read_only>false</read_only><read_roles/><reference/><reference_cascade_rule/><reference_floats>false</reference_floats><reference_key/><reference_qual/><reference_qual_condition/><reference_type/><spell_check>false</spell_check><staged>false</staged><sys_class_name>sys_dictionary</sys_class_name><sys_created_by>ggb0926</sys_created_by><sys_created_on>2023-08-31 20:13:41</sys_created_on><sys_id>c8e41a709705f1103e1432890353af07</sys_id><sys_name>V1</sys_name><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_dictionary_u_log_u_string1</sys_update_name><sys_updated_by>ggb0926</sys_updated_by><sys_updated_on>2023-08-31 20:13:41</sys_updated_on><table_reference>false</table_reference><text_index>false</text_index><unique>false</unique><use_dependent_field>false</use_dependent_field><use_dynamic_default>false</use_dynamic_default><use_reference_qualifier>simple</use_reference_qualifier><virtual>false</virtual><virtual_type>script</virtual_type><widget/><write_roles/><xml_view>false</xml_view></sys_dictionary></record_update>2187487486cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28a0fe846497075a9035e97666f053afa90194471a47bd0000001jwj02152025-01-08 18:09:28
u_log
User Log.V1Dictionaryglobal4eae44a44c075a908432c1354d8120d74eae44a44c075a908432c1354d8120d7:218748748,d0d61e74ff05f110c7e9e4d97211df3d:218748748INSERT_OR_UPDATEglobalcustomersys_dictionary_u_log_u_string8<?xml version="1.0" encoding="UTF-8"?><record_update><sys_dictionary action="INSERT_OR_UPDATE" element="u_string8" table="u_log"><active>true</active><array>false</array><attributes/><audit>false</audit><calculation><![CDATA[(function calculatedFieldValue(current) {
// Add your code here
return ''; // return the calculated value
})(current);]]></calculation><choice/><choice_field/><choice_table/><column_label>V8</column_label><comments/><create_roles/><default_value/><defaultsort/><delete_roles/><dependent/><dependent_on_field/><display>false</display><dynamic_creation>false</dynamic_creation><dynamic_creation_script/><dynamic_default_value/><dynamic_ref_qual/><element>u_string8</element><element_reference>false</element_reference><foreign_database/><formula/><function_definition/><function_field>false</function_field><internal_type display_value="String">string</internal_type><mandatory>false</mandatory><max_length>4000</max_length><name>u_log</name><next_element/><primary>false</primary><read_only>false</read_only><read_roles/><reference/><reference_cascade_rule/><reference_floats>false</reference_floats><reference_key/><reference_qual/><reference_qual_condition/><reference_type/><spell_check>false</spell_check><staged>false</staged><sys_class_name>sys_dictionary</sys_class_name><sys_created_by>ggb0926</sys_created_by><sys_created_on>2023-08-31 20:13:42</sys_created_on><sys_id>d07596309705f1103e1432890353af8d</sys_id><sys_name>V8</sys_name><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_dictionary_u_log_u_string8</sys_update_name><sys_updated_by>ggb0926</sys_updated_by><sys_updated_on>2023-08-31 20:13:42</sys_updated_on><table_reference>false</table_reference><text_index>false</text_index><unique>false</unique><use_dependent_field>false</use_dependent_field><use_dynamic_default>false</use_dynamic_default><use_reference_qualifier>simple</use_reference_qualifier><virtual>false</virtual><virtual_type>script</virtual_type><widget/><write_roles/><xml_view>false</xml_view></sys_dictionary></record_update>-5300440846cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28a0fe8ca497075a9035e97666f053af9e0194471a495e0000001jwj02152025-01-08 18:09:28
u_log
User Log.V8Dictionaryglobal42ae44a409075a90faf52aaa064fc5f942ae44a409075a90faf52aaa064fc5f9:-530044084,24d61e743305f11036ed8dcdabe8a46f:-530044084INSERT_OR_UPDATEglobalcustomersys_documentation_u_log_u_string7_enu_string7enu_logV7ssys_documentationggb09262023-08-31 20:13:4334d65e749705f1103e1432890353af200V7globalglobalsys_documentation_u_log_u_string7_enggb09262023-08-31 20:13:43]]>-9570229436cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28a0fe8ca497075a9035e97666f053afa10194471a4b100000001jwj02152025-01-08 18:09:28
u_log
User Log.V7Field Labelglobal1eae84a4ad075a901353fca2645d51301eae84a4ad075a901353fca2645d5130:-957022943,fcd65e740e05f1102f1188408c94c755:-957022943INSERT_OR_UPDATEglobalcustomersys_security_acl_role_f8d61e749705f1103e1432890353afcasys_security_acl_roleggb09262023-08-31 20:13:43f8d61e749705f1103e1432890353afca2u_log.user_log_adminglobalglobalbcd61e749705f1103e1432890353afc6sys_security_acl_role_f8d61e749705f1103e1432890353afcajwj02152024-07-25 15:40:55f30ae76a97670a10260839200153af59]]>17044784066cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28a0fe8ca497075a9035e97666f053afa40194471a4ecb0000001jwj02152025-01-08 18:09:28
u_log
u_log.user_log_adminAccess Rolesglobal66ae84a4ee075a90d4856af62ec5ee9c66ae84a4ee075a90d4856af62ec5ee9c:1704478406,187b2b6212a70a10f797de088fd7a5f7:1704478406,783daaae0ef10a9487a1addfd7e00e14:1486906158,6346728f8adf35d0ce2801aef1f4981d:-1976727905,34d61e744205f110b952ad9a45f9bfcc:844720612INSERT_OR_UPDATEglobalcustomersys_dictionary_u_log_u_string4<?xml version="1.0" encoding="UTF-8"?><record_update><sys_dictionary action="INSERT_OR_UPDATE" element="u_string4" table="u_log"><active>true</active><array>false</array><attributes/><audit>false</audit><calculation><![CDATA[(function calculatedFieldValue(current) {
// Add your code here
return ''; // return the calculated value
})(current);]]></calculation><choice/><choice_field/><choice_table/><column_label>V4</column_label><comments/><create_roles/><default_value/><defaultsort/><delete_roles/><dependent/><dependent_on_field/><display>false</display><dynamic_creation>false</dynamic_creation><dynamic_creation_script/><dynamic_default_value/><dynamic_ref_qual/><element>u_string4</element><element_reference>false</element_reference><foreign_database/><formula/><function_definition/><function_field>false</function_field><internal_type display_value="String">string</internal_type><mandatory>false</mandatory><max_length>4000</max_length><name>u_log</name><next_element/><primary>false</primary><read_only>false</read_only><read_roles/><reference/><reference_cascade_rule/><reference_floats>false</reference_floats><reference_key/><reference_qual/><reference_qual_condition/><reference_type/><spell_check>false</spell_check><staged>false</staged><sys_class_name>sys_dictionary</sys_class_name><sys_created_by>ggb0926</sys_created_by><sys_created_on>2023-08-31 20:13:42</sys_created_on><sys_id>062592709705f1103e1432890353af51</sys_id><sys_name>V4</sys_name><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_dictionary_u_log_u_string4</sys_update_name><sys_updated_by>ggb0926</sys_updated_by><sys_updated_on>2023-08-31 20:13:42</sys_updated_on><table_reference>false</table_reference><text_index>false</text_index><unique>false</unique><use_dependent_field>false</use_dependent_field><use_dynamic_default>false</use_dynamic_default><use_reference_qualifier>simple</use_reference_qualifier><virtual>false</virtual><virtual_type>script</virtual_type><widget/><write_roles/><xml_view>false</xml_view></sys_dictionary></record_update>17385378046cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28a4fe8ca497075a9035e97666f053af9d0194471a486e0000001jwj02152025-01-08 18:09:28
u_log
User Log.V4Dictionaryglobal42ae44a407075a900a5e2ac61c8b22e642ae44a407075a900a5e2ac61c8b22e6:1738537804,54d61e742c05f110bdd58482a006134d:1738537804INSERT_OR_UPDATEglobalcustomersys_documentation_u_log_u_string3_enu_string3enu_logV3ssys_documentationggb09262023-08-31 20:13:433cd65e749705f1103e1432890353af1b0V3globalglobalsys_documentation_u_log_u_string3_enggb09262023-08-31 20:13:43]]>4040694176cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28a4fe8ca497075a9035e97666f053afa00194471a4b6b0000001jwj02152025-01-08 18:09:28
u_log
User Log.V3Field Labelglobal5aae84a4c6075a908f0969ed90b875435aae84a4c6075a908f0969ed90b87543:404069417,fcd65e747f05f1100169e3097ebda05b:404069417INSERT_OR_UPDATEglobalcustomersys_security_acl_f4d61e749705f1103e1432890353afb3truetruefalseDefault access control on u_logLocalu_logwritesys_security_aclggb09262023-08-31 20:13:43f4d61e749705f1103e1432890353afb30u_logglobalglobalsys_security_acl_f4d61e749705f1103e1432890353afb3ggb09262023-08-31 20:13:43record]]>-14518288566cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28a4fe8ca497075a9035e97666f053afa30194471a4f470000001jwj02152025-01-08 18:09:28
User Log.UpdatedField Labelglobal92ae84a468075a90834cba9ad102927592ae84a468075a90834cba9ad1029275:1061521878,78917e54ff1235509b3a20e847c08547:1061521878INSERT_OR_UPDATEglobalcustomersys_script_include_c738dd9a1b787d10c4fec913604bcb28<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_script_include"><sys_script_include action="INSERT_OR_UPDATE"><access>public</access><active>true</active><api_name>global.ClearUserLog</api_name><caller_access/><client_callable>false</client_callable><description>Deletes all records from custom User Log (table u_log).</description><name>ClearUserLog</name><script><![CDATA[function ClearUserLog()
{
var gr = new GlideRecord("u_log");
//Clear out only those messages logged by the current user.
//This allows multiple developers to make use of the User Log without interfering with each other.
//Each developer may filter by his own Username.
gr.addQuery("sys_created_by", gs.getUserName());
gr.query();
gr.deleteMultiple();
}
]]></script><sys_class_name>sys_script_include</sys_class_name><sys_created_by>ggb0926</sys_created_by><sys_created_on>2023-08-23 21:15:27</sys_created_on><sys_id>c738dd9a1b787d10c4fec913604bcb28</sys_id><sys_mod_count>7</sys_mod_count><sys_name>ClearUserLog</sys_name><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_script_include_c738dd9a1b787d10c4fec913604bcb28</sys_update_name><sys_updated_by>ggb0926</sys_updated_by><sys_updated_on>2023-09-04 14:19:36</sys_updated_on></sys_script_include></record_update>17362588916cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28a8fe8ca497075a9035e97666f053afa20194470fdf1e0000001jwj02152025-01-08 18:09:28
User Log.CreatedField Labelglobal5aae84a48f075a901acd4aa2ba1bba475aae84a48f075a901acd4aa2ba1bba47:1059689091,b4917e54751235502b3d9e3f0cfa3530:1059689091INSERT_OR_UPDATEglobalcustomersys_documentation_u_log__enenu_logUser Logssys_documentationggb09262023-08-31 20:13:43b0d61e749705f1103e1432890353afe20User Logglobalglobalsys_documentation_u_log__enggb09262023-08-31 20:13:43]]>-20664695216cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28acfe8ca497075a9035e97666f053afa10194471a4bc50000001jwj02152025-01-08 18:09:28
u_log
User LogField Labelglobaldaae84a41c075a90646e89634ae53b49daae84a41c075a90646e89634ae53b49:-2066469521,bcd65e746805f1107cc2300b1012a85d:-2066469521INSERT_OR_UPDATEglobalcustomersys_dictionary_u_log_u_string3<?xml version="1.0" encoding="UTF-8"?><record_update><sys_dictionary action="INSERT_OR_UPDATE" element="u_string3" table="u_log"><active>true</active><array>false</array><attributes/><audit>false</audit><calculation><![CDATA[(function calculatedFieldValue(current) {
// Add your code here
return ''; // return the calculated value
})(current);]]></calculation><choice/><choice_field/><choice_table/><column_label>V3</column_label><comments/><create_roles/><default_value/><defaultsort/><delete_roles/><dependent/><dependent_on_field/><display>false</display><dynamic_creation>false</dynamic_creation><dynamic_creation_script/><dynamic_default_value/><dynamic_ref_qual/><element>u_string3</element><element_reference>false</element_reference><foreign_database/><formula/><function_definition/><function_field>false</function_field><internal_type display_value="String">string</internal_type><mandatory>false</mandatory><max_length>4000</max_length><name>u_log</name><next_element/><primary>false</primary><read_only>false</read_only><read_roles/><reference/><reference_cascade_rule/><reference_floats>false</reference_floats><reference_key/><reference_qual/><reference_qual_condition/><reference_type/><spell_check>false</spell_check><staged>false</staged><sys_class_name>sys_dictionary</sys_class_name><sys_created_by>ggb0926</sys_created_by><sys_created_on>2023-08-31 20:13:42</sys_created_on><sys_id>a61516b09705f1103e1432890353af76</sys_id><sys_name>V3</sys_name><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_dictionary_u_log_u_string3</sys_update_name><sys_updated_by>ggb0926</sys_updated_by><sys_updated_on>2023-08-31 20:13:42</sys_updated_on><table_reference>false</table_reference><text_index>false</text_index><unique>false</unique><use_dependent_field>false</use_dependent_field><use_dynamic_default>false</use_dynamic_default><use_reference_qualifier>simple</use_reference_qualifier><virtual>false</virtual><virtual_type>script</virtual_type><widget/><write_roles/><xml_view>false</xml_view></sys_dictionary></record_update>12319414526cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28e0fe8ca497075a9035e97666f053af9d0194471a48340000001jwj02152025-01-08 18:09:28
u_log
User Log.V3Dictionaryglobal46ae44a4f5075a903f57319b7d5fb7e146ae44a4f5075a903f57319b7d5fb7e1:1231941452,dcd61e74cf05f110b32d96126afb3447:1231941452INSERT_OR_UPDATEglobalcustomersys_documentation_u_log_u_string2_enu_string2enu_logV2ssys_documentationggb09262023-08-31 20:13:43b8d65e749705f1103e1432890353af1a0V2globalglobalsys_documentation_u_log_u_string2_enggb09262023-08-31 20:13:43]]>7443425076cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28e0fe8ca497075a9035e97666f053afa00194471a4c460000001jwj02152025-01-08 18:09:28
u_log
User Log.V2Field Labelglobald6ae84a448075a90b3a379efff613060d6ae84a448075a90b3a379efff613060:744342507,0dd65e744f05f1102601b5f2ce30e87c:744342507INSERT_OR_UPDATEglobalcustomersys_security_acl_e4d61e749705f1103e1432890353afactruetruefalseDefault access control on u_logLocalu_logreadsys_security_aclggb09262023-08-31 20:13:43e4d61e749705f1103e1432890353afac0u_logglobalglobalsys_security_acl_e4d61e749705f1103e1432890353afacggb09262023-08-31 20:13:43record]]>-11848054366cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28e0fe8ca497075a9035e97666f053afa30194471a4ef00000001jwj02152025-01-08 18:09:28
User Log.Updated byField Labelglobal5aae84a43f075a90a9d49607ea0235645aae84a43f075a90a9d49607ea023564:-1940280489,7c917e54c712355091bf00ff4090b142:-1940280489INSERT_OR_UPDATEglobalcustomersys_script_include_9f8905a81b097110c4fec913604bcbf4<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_script_include"><sys_script_include action="INSERT_OR_UPDATE"><access>public</access><active>false</active><api_name>global.AddCommas</api_name><caller_access/><client_callable>false</client_callable><description>MOVED TO THEDACAREUTILS
Adds commas to a long number.</description><name>AddCommas</name><script><![CDATA[function AddCommas(x)
{
x = x.toString();
var pattern = /(-?\d+)(\d{3})/;
while (pattern.test(x))
x = x.replace(pattern, "$1,$2");
return x;
}
]]></script><sys_class_name>sys_script_include</sys_class_name><sys_created_by>ggb0926</sys_created_by><sys_created_on>2023-08-30 19:57:38</sys_created_on><sys_id>9f8905a81b097110c4fec913604bcbf4</sys_id><sys_mod_count>4</sys_mod_count><sys_name>AddCommas</sys_name><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_script_include_9f8905a81b097110c4fec913604bcbf4</sys_update_name><sys_updated_by>ggb0926</sys_updated_by><sys_updated_on>2023-09-29 20:29:07</sys_updated_on></sys_script_include></record_update>5417945086cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28e4fe8ca497075a9035e97666f053afa20194471319090000001jwj02152025-01-08 18:09:28
User Log.Created byField Labelglobal1eae84a4b0075a90b84fd73231485f4d1eae84a4b0075a90b84fd73231485f4d:-1906317110,f0917e54dd1235509aafd04324a47b37:-1906317110INSERT_OR_UPDATEglobalcustomersys_documentation_u_log_u_timestamp_enu_timestampenu_logTimestampssys_documentationggb09262023-08-31 20:13:43b8d65e749705f1103e1432890353af230Timestampglobalglobalsys_documentation_u_log_u_timestamp_enggb09262023-08-31 20:13:43]]>9549905896cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28e8fe8ca497075a9035e97666f053afa10194471a4c5f0000001jwj02152025-01-08 18:09:28
u_log
User Log.TimestampField Labelglobal5aae84a414075a90418fdd830f080f625aae84a414075a90418fdd830f080f62:954990589,0dd65e741a05f110325c589f56c11b7e:954990589INSERT_OR_UPDATEglobalcustomersys_user_role_f30ae76a97670a10260839200153af59trueAdmin over the User Log Tablefalsetrueuser_log_adminfalsesys_user_rolejwj02152024-07-25 15:35:27f30ae76a97670a10260839200153af591user_log_adminglobalglobalsys_user_role_f30ae76a97670a10260839200153af59jwj02152024-07-25 15:39:00]]>-3467999466cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28e8fe8ca497075a9035e97666f053afa40194471a4f630000001jwj02152025-01-08 18:09:28
user_log_adminRoleglobal22ae84a494075a90c7b4fc00534298a822ae84a494075a90c7b4fc00534298a8:-346799946,180bafae92670a1025394de5e1eb6c83:-346799946,ac3a27aa16670a10509b86a6eed46669:2044290979INSERT_OR_UPDATEglobalcustomersys_dictionary_u_log_u_string0<?xml version="1.0" encoding="UTF-8"?><record_update><sys_dictionary action="INSERT_OR_UPDATE" element="u_string0" table="u_log"><active>true</active><array>false</array><attributes/><audit>false</audit><calculation><![CDATA[(function calculatedFieldValue(current) {
// Add your code here
return ''; // return the calculated value
})(current);]]></calculation><choice/><choice_field/><choice_table/><column_label>V0</column_label><comments/><create_roles/><default_value/><defaultsort/><delete_roles/><dependent/><dependent_on_field/><display>false</display><dynamic_creation>false</dynamic_creation><dynamic_creation_script/><dynamic_default_value/><dynamic_ref_qual/><element>u_string0</element><element_reference>false</element_reference><foreign_database/><formula/><function_definition/><function_field>false</function_field><internal_type display_value="String">string</internal_type><mandatory>false</mandatory><max_length>4000</max_length><name>u_log</name><next_element/><primary>false</primary><read_only>false</read_only><read_roles/><reference/><reference_cascade_rule/><reference_floats>false</reference_floats><reference_key/><reference_qual/><reference_qual_condition/><reference_type/><spell_check>false</spell_check><staged>false</staged><sys_class_name>sys_dictionary</sys_class_name><sys_created_by>ggb0926</sys_created_by><sys_created_on>2023-08-31 20:13:41</sys_created_on><sys_id>dd44d6709705f1103e1432890353aff4</sys_id><sys_name>V0</sys_name><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_dictionary_u_log_u_string0</sys_update_name><sys_updated_by>ggb0926</sys_updated_by><sys_updated_on>2023-08-31 20:13:41</sys_updated_on><table_reference>false</table_reference><text_index>false</text_index><unique>false</unique><use_dependent_field>false</use_dependent_field><use_dynamic_default>false</use_dynamic_default><use_reference_qualifier>simple</use_reference_qualifier><virtual>false</virtual><virtual_type>script</virtual_type><widget/><write_roles/><xml_view>false</xml_view></sys_dictionary></record_update>-2878476046cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28ecfe846497075a9035e97666f053afa80194471a47820000001jwj02152025-01-08 18:09:28
u_log
User Log.V0Dictionaryglobal42ae44a4f9075a9074873e3877fb4cd342ae44a4f9075a9074873e3877fb4cd3:-287847604,50d652343705f110336f048680a73c59:-287847604INSERT_OR_UPDATEglobalcustomersys_dictionary_u_log_u_string7<?xml version="1.0" encoding="UTF-8"?><record_update><sys_dictionary action="INSERT_OR_UPDATE" element="u_string7" table="u_log"><active>true</active><array>false</array><attributes/><audit>false</audit><calculation><![CDATA[(function calculatedFieldValue(current) {
// Add your code here
return ''; // return the calculated value
})(current);]]></calculation><choice/><choice_field/><choice_table/><column_label>V7</column_label><comments/><create_roles/><default_value/><defaultsort/><delete_roles/><dependent/><dependent_on_field/><display>false</display><dynamic_creation>false</dynamic_creation><dynamic_creation_script/><dynamic_default_value/><dynamic_ref_qual/><element>u_string7</element><element_reference>false</element_reference><foreign_database/><formula/><function_definition/><function_field>false</function_field><internal_type display_value="String">string</internal_type><mandatory>false</mandatory><max_length>4000</max_length><name>u_log</name><next_element/><primary>false</primary><read_only>false</read_only><read_roles/><reference/><reference_cascade_rule/><reference_floats>false</reference_floats><reference_key/><reference_qual/><reference_qual_condition/><reference_type/><spell_check>false</spell_check><staged>false</staged><sys_class_name>sys_dictionary</sys_class_name><sys_created_by>ggb0926</sys_created_by><sys_created_on>2023-08-31 20:13:42</sys_created_on><sys_id>7d55d6f09705f1103e1432890353af02</sys_id><sys_name>V7</sys_name><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_dictionary_u_log_u_string7</sys_update_name><sys_updated_by>ggb0926</sys_updated_by><sys_updated_on>2023-08-31 20:13:42</sys_updated_on><table_reference>false</table_reference><text_index>false</text_index><unique>false</unique><use_dependent_field>false</use_dependent_field><use_dynamic_default>false</use_dynamic_default><use_reference_qualifier>simple</use_reference_qualifier><virtual>false</virtual><virtual_type>script</virtual_type><widget/><write_roles/><xml_view>false</xml_view></sys_dictionary></record_update>-10366404366cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28ecfe8ca497075a9035e97666f053af9d0194471a49260000001jwj02152025-01-08 18:09:28
u_log
User Log.V7Dictionaryglobal46ae44a457075a90e455dcf7b81108f446ae44a457075a90e455dcf7b81108f4:-1036640436,e4d61e745005f1104d71166deffcd75d:-1036640436INSERT_OR_UPDATEglobalcustomersys_documentation_u_log_u_string6_enu_string6enu_logV6ssys_documentationggb09262023-08-31 20:13:43b0d65e749705f1103e1432890353af1f0V6globalglobalsys_documentation_u_log_u_string6_enggb09262023-08-31 20:13:43]]>-6167498536cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28ecfe8ca497075a9035e97666f053afa00194471a4be00000001jwj02152025-01-08 18:09:28
u_log
User Log.V6Field Labelglobal1eae84a4b2075a90883df351db0a4a4b1eae84a4b2075a90883df351db0a4a4b:-616749853,bcd65e749d05f1105c82065fb02b515f:-616749853INSERT_OR_UPDATEglobalcustomersys_security_acl_role_f8d61e749705f1103e1432890353afc3sys_security_acl_roleggb09262023-08-31 20:13:43f8d61e749705f1103e1432890353afc32u_log.user_log_adminglobalglobalf4d61e749705f1103e1432890353afb3sys_security_acl_role_f8d61e749705f1103e1432890353afc3jwj02152024-07-25 15:40:55f30ae76a97670a10260839200153af59]]>14562109396cfe846497075a9035e97666f053afa7falsejwj02152025-01-08 18:09:28ecfe8ca497075a9035e97666f053afa30194471a4f7e0000001jwj02152025-01-08 18:09:28
u_log
u_log.user_log_adminAccess Rolesglobal66ae84a4a3075a90eadf402d0ed362aa66ae84a4a3075a90eadf402d0ed362aa:1456210939,587b2b6246a70a106f48944df1d8edf3:1456210939,7c3daaaeccf10a94aa5cfa3d1350903d:1897493411,e346728f74df35d0d9b1528db3ef7300:1201852106,34d61e744305f110abb2e25e7252c1c5:776519887
----
=====User Select UI=====
This is used to toggle between Polaris and the old UI. It is depricated, as all use Polaris now.
globalGlobalglobalUpdate Set will allow the user to toggle the logged in user's preference (Next UI --> UI 16 or UI16 --> Next UI)
You will need to globally enable it with the Property, but can then globally disable it with the System user preference and allow people to opt in with this, or to let people opt back to UI16 while keeping everyone else on Next UI.
-------------------------------------------
Links:
https://INSTANCE.service-now.com/experience_select.do [Select UI Page]
https://INSTANCE.service-now.com/sys_ui_page.do?sys_id=ed579c2a973201106990318c1253af58 [UI Page]
https://INSTANCE.service-now.com/sys_user_preference_list.do?sysparm_query=nameSTARTSWITHglide.ui.polaris.use%5EGROUPBYuser [User Preferences]
https://community.servicenow.com/community?id=community_Article&sys_id=ec26e2581bfa8d50c465ece6b04bcb32 [Community Article]CZ - Polaris UI User Select72ecf9f9875a9610fdd876a6cebb3591loadedsys_remote_update_setjwj02152025-01-08 21:02:094a76bc64970b5a9035e97666f053af050jwj02152025-01-08 21:02:09INSERT_OR_UPDATEglobalretrievedsys_attachment_e7a9852a97f201106990318c1253af4d#ececee700000trueimage/pngpolaris.pnged7e0e2a200e6eaed38e43bab632e00f58c538eb47ab2a4ecc8d7e5bafee5f0e9381915114010102716availablechristoph.lang2022-04-01 08:00:00e7a9852a97f201106990318c1253af4d3christoph.lang2022-04-01 08:00:00sys_ui_pageed579c2a973201106990318c1253af58]]>742370544a76bc64970b5a9035e97666f053af05falsejwj02152025-01-08 21:02:090676bc64970b5a9035e97666f053af0701939cd355310000001jwj02152025-01-08 21:02:09
ui16.pngAttachmentglobald06c4daa38f20110c55426ede9f0a4bdd06c4daa38f20110c55426ede9f0a4bd:655275465INSERT_OR_UPDATEglobalretrievedsys_app_module_d265452697f201106990318c1253af7btrue08771d0cc0a8016401f604303b94b999DIRECTSelect your ExperienceMobile1022false/experience_select.dosys_app_modulechristoph.lang2022-04-01 08:00:00global/d265452697f201106990318c1253af7b1Select your Experienceglobalglobalsys_app_module_d265452697f201106990318c1253af7bchristoph.lang2022-04-01 08:00:00Select your Experiencefalse]]>12652456264a76bc64970b5a9035e97666f053af05falsejwj02152025-01-08 21:02:094e76bc64970b5a9035e97666f053af0501939cd3552a0000001jwj02152025-01-08 21:02:09