<?xml version="1.0" encoding="UTF-8"?>
<unload unload_date="2016-03-20 03:24:31">
<sys_remote_update_set action="INSERT_OR_UPDATE">
<application display_value="Global">global</application>
<application_name>Global</application_name>
<application_scope>global</application_scope>
<application_version/>
<collisions/>
<commit_date/>
<deleted/>
<description>Version 2.0.1</description>
<inserted/>
<name>Update Set Conflict Checker V2.0.1</name>
<origin_sys_id/>
<release_date/>
<remote_sys_id>f01d7dc94f92d200bf004a318110c7a9</remote_sys_id>
<state>loaded</state>
<summary/>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2016-03-20 03:24:31</sys_created_on>
<sys_id>917b87014f16d200bf004a318110c7cd</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2016-03-20 03:24:31</sys_updated_on>
<update_set display_value=""/>
<update_source display_value=""/>
<updated/>
</sys_remote_update_set>
<sys_update_xml action="INSERT_OR_UPDATE">
<action>INSERT_OR_UPDATE</action>
<application display_value="Global">global</application>
<category>customer</category>
<comments/>
<name>sys_app_module_505a5e054fd2d200bf004a318110c70e</name>
<payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update sys_domain="global" table="sys_app_module"><sys_app_module action="INSERT_OR_UPDATE"><active>true</active><application display_value="ServiceNow Guys">8e7dfdc94f92d200bf004a318110c7d8</application><assessment/><content_page/><device_type/><filter table="sys_properties">nameSTARTSWITHsncg.usca.^EQ<item endquery="false" field="name" goto="false" newquery="false" operator="STARTSWITH" or="false" value="sncg.usca."/><item endquery="true" field="" goto="false" newquery="false" operator="=" or="false" value=""/></filter><hint>View and modify properties related to the USCA tool.</hint><homepage/><image/><link_type>DIRECT</link_type><map_page/><mobile_title>USCA Properties</mobile_title><mobile_view_name>Mobile</mobile_view_name><name>sys_properties</name><order>400</order><override_menu_roles>true</override_menu_roles><query>system_properties_ui.do?sysparm_title=Update%20Set%20Collision%20Avoidance%20Properties&amp;sysparm_category=usca</query><report/><roles>admin</roles><survey/><survey_overwrite>true</survey_overwrite><sys_class_name>sys_app_module</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>2016-03-19 23:54:04</sys_created_on><sys_customer_update>true</sys_customer_update><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>505a5e054fd2d200bf004a318110c70e</sys_id><sys_mod_count>1</sys_mod_count><sys_name>USCA Properties</sys_name><sys_overrides/><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_replace_on_upgrade>false</sys_replace_on_upgrade><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_app_module_505a5e054fd2d200bf004a318110c70e</sys_update_name><sys_updated_by>admin</sys_updated_by><sys_updated_on>2016-03-20 00:15:29</sys_updated_on><timeline_page/><title>USCA Properties</title><uncancelable>false</uncancelable><view_name/><window_name/></sys_app_module></record_update>]]></payload>
<remote_update_set display_value="Update Set Conflict Checker V2.0.1">917b87014f16d200bf004a318110c7cd</remote_update_set>
<replace_on_upgrade>false</replace_on_upgrade>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2016-03-20 03:24:31</sys_created_on>
<sys_id>157b87014f16d200bf004a318110c7cd</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2016-03-20 03:24:31</sys_updated_on>
<table>sys_properties</table>
<target_name>USCA Properties</target_name>
<type>Module</type>
<update_domain>global</update_domain>
<update_set display_value=""/>
<view/>
</sys_update_xml>
<sys_update_xml action="INSERT_OR_UPDATE">
<action>INSERT_OR_UPDATE</action>
<application display_value="Global">global</application>
<category>customer</category>
<comments/>
<name>sys_script_include_ee7dcecd4f92d200bf004a318110c764</name>
<payload>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;record_update table="sys_script_include"&gt;&lt;sys_script_include action="INSERT_OR_UPDATE"&gt;&lt;access&gt;public&lt;/access&gt;&lt;active&gt;true&lt;/active&gt;&lt;api_name&gt;global.USCAInstaller&lt;/api_name&gt;&lt;client_callable&gt;false&lt;/client_callable&gt;&lt;description&gt;This class exposes two functions which can be used to install or uninstall the USCA tool: &amp;#13;
Install: UpdateSetCollisionAvoidance().installUSCA();&amp;#13;
Uninstall: UpdateSetCollisionAvoidance().uninstallUSCA()&lt;/description&gt;&lt;name&gt;USCAInstaller&lt;/name&gt;&lt;script&gt;&lt;![CDATA[var USCAInstaller = Class.create();
USCAInstaller.prototype = {
	initialize: function() {
		this.setVars();
	},
	
	
	
	/**
		* Installs the ServiceNow Guys Update Set Collision Avoidance (USCA) tool to your instance. 
		@public
	*/
	installUSCA: function() {
		this.doWork();
	},
	
	/**
		* Uninstalls the ServiceNow Guys Update Set Collision Avoidance (USCA) tool from your instance. 
		@public
	*/
	uninstallUSCA: function() {
		this.deleteUSCA(true);
	},
	
	
	
	
	
	
	/**
		* Does the work of installing the Update Set Collision Avoidance (USCA) tool.
		* @private
	*/
	doWork: function() {		
		//Get a list of all the tables that have the update synch attribute turned on.
		/* NOTE: 
			Change this argument to false in order to make it so every table (regardless of whether it has any records)
			gets a monitoring business rule installed. This will significantly increase the install time, but 
		*/
		var updateSynchTables = this.getListOfUpdateSynchTables(true);
		
		//Get a list of tables that already have a conflict checker business rule.
		var tablesAlreadyDone = this.getTablesAlreadyDone(); //DONE
		
		//Ensure that the script include that does most of the work exists, and get its' sys_id.
		var scriptIncludeSysID = this.getScriptInclude(); //DONE
		
		//Get a list of the tables that need doing (which is the list of all update synch tables, 
		//MINUS any tables in the array of tables that have already been done).
		var tablesToDo = this.getTablesToDo(updateSynchTables, tablesAlreadyDone); //DONE
		
		//Check for system properties relevant to this app. If they don't exist, create them.
		var properties = this.setProperties(); //DONE
		
		//Create a business rule for every table in tablesToDo, and get an array of sys_ids of each.
		var createdBusinessRules = this.createBusinessRules(tablesToDo); //WIP
		
		gs.log('ServiceNow Guys - Update Set Collision Avoidance tool has been installed. Any errors will be shown in your system error logs. ');
	},
	
	/**
		* Simple function that sets some variables in the parent object scope.
		* @private
	*/
	setVars: function() {
		this.nameOfScriptInclude = 'checkUpdateSetConflict';
		this.nameOfBusinessRule = 'Check for update set conflicts';
		//declare a pseudo-hash of properties to be declared.
		this.propHash = {
			'warn_on_default_update_set': {
				type: 'boolean',
				value: 'true',
				description: 'Whether to display a warning message when a user has the Default update set selected. \ntrue: yes, false: no, default: true.'
			},
			'warn_when_same_user': {
				type: 'boolean',
				value: 'false',
				description: 'Whether to display a warning if the current user is the one that created the potentially conflicting update set. \ntrue: yes, false: no, default: false.'
			}
		};
	},
	
	/**
		* @description Gets a list of all of the tables in the instance that have the update_synch attribute turned on.
		* @param {Boolean} [checkForRecords=true] Whether or not to check if the table contains at least one record. If this 
		* param is true, then this function will only return tables that contain at least one record. (Bool, not string)
		* @returns {Array} List of sys_class_names for all update_synch tables in the instance
		* @private
	*/
	getListOfUpdateSynchTables: function(checkForRecords) {
		//strict compare to check if false was actually passed in, versus a falsey value like undefined.
		if (checkForRecords !== false) {
			checkForRecords = true;
		}
		//The encoded query that finds all update_synch tables in the dictionary.
		var encQuery = 'attributesLIKEupdate_synch^internal_type=collection^active=true';
		//set up vars
		var tableClassName = '';
		var listOfClassIDs = [];
		try {
			//Create a GlideRecorod on the system dictionary, and get all the collections matching the above encoded query.
			var gr = new GlideRecord('sys_dictionary');
			gr.addEncodedQuery(encQuery);
			gr.query();
			while (gr.next()) {
				tableClassName = gr.getValue('sys_name');
				if (this.checkIfTableContainsRecords(tableClassName) || !checkForRecords) {
					listOfClassIDs.push(tableClassName);
				}
			}
		}
		catch (err) {
			var errMsg = err.message;
			gs.logError('getListOfUpdateSynchTables error: ' + errMsg, 'USCA.getListOfUpdateSynchTables');
		}
		var aut = new ArrayUtil();
		listOfClassIDs = aut.unique(listOfClassIDs);
		return listOfClassIDs;
	},
	
	/**
		* @description Checks whether the passed table contains at least one record.
		* @param {string} [tableClassName] The sys_class_name of the table to be checked for records.
		* @returns {Boolean} Whether the passed table contains at least one record.
		* @private
	*/
	checkIfTableContainsRecords: function(tableClassName) {
		if (!tableClassName) {
			return false;
		}
		var gr = new GlideRecord(tableClassName);
		gr.setLimit(1);
		gr.query();
		var resultBool = gr.hasNext();
		return resultBool;
	},
	
	/**
		* @description Gets a list of tables (by sys_class_name) that already have existing business rules that function as conflict avoidance checkers.
		* @returns {Array} A list of sys_class_names for tables that 
		* @private
	*/
	getTablesAlreadyDone: function() {
		var aut = new ArrayUtil();
		var listOfDoneTables = [];
		var encQuery = 'active=true^name=' + this.nameOfBusinessRule;
		var gr = new GlideRecord('sys_script');
		gr.addEncodedQuery(encQuery);
		gr.query();
		while (gr.next()) {
			var tableName = gr.getValue('collection');
			//Make sure we've got a value, and that it isn't 'global'. Then, push it to our array. 
			if (tableName &amp;&amp; tableName != 'global') {
				listOfDoneTables.push(tableName);
			}
		}
		listOfDoneTables = aut.unique(listOfDoneTables);
		return listOfDoneTables;
	},
	
	/**
		* @description Gets the sys_id script include responsible for doing most of the work of checking for an update set conflict and alerting the user. If it does not exist, getScriptInclude creates it.
		* @returns {string} sys_id of the script include. 
		* @private
	*/
	getScriptInclude: function() {
		//Check if script include exists. 
		//If so, return sys ID
		//If not, create it, and return sys ID. 
		var scriptValue;
		var descriptionText;
		var scriptSysID = '';
		var accessVal = 'public';
		var clientCallableVal = 'true';
		var encQuery = 'active=true^name=' + this.nameOfScriptInclude;
		
		var gr = new GlideRecord('sys_script_include');
		gr.addEncodedQuery(encQuery);
		gr.query();
		
		if (gr.next()) {
			//If the script include exists, get the sys_id
			scriptSysID = gr.getValue('sys_id');
		}
		else {
			//If the script include DOES NOT exist, create it, then get the sys_id. 
			//This monster variable, scriptValue, holds the compiled code that goes into the script. 
			scriptValue = 'function checkUpdateSetConflict(a){var b={conflict:!1,updateSetValid:!0,updateSetName:"",updateSetOwner:"",daysAgo:0,noConflictReason:""},f=new GlideRecord("sys_update_set");if(f.get(gs.getPreference("sys_update_set"))){var f=f.getValue("name"),l=JSON.parse(gs.getProperty("sncg.usca.warn_on_default_update_set")),g=JSON.parse(gs.getProperty("sncg.usca.warn_when_same_user")),e=a.getValue("sys_id"),e=a.getValue("sys_class_name")+"_"+e;a=new GlideRecord("sys_update_version");a.addQuery("name",e);a.addQuery("state",\n' +
			'"current");a.query();if(a.next()){var h,c,k,d;d=new GlideDateTime;d=gs.nowDateTime();c=new GlideRecord("sys_update_set");h=a.getValue("source");c.get(h);a=c.getValue("name");e=c.getValue("sys_created_by");k=new GlideDateTime(c.getValue("sys_created_on"));k=gs.dateDiff(k.getDisplayValue(),d.getDisplayValue(),!0);d=Math.round(k/60/60/24);86400&gt;k&amp;&amp;(d=0);0!==a.toLowerCase().indexOf("default")?(c=c.getValue("state"),"in progress"==c?(c=gs.getUser().getName(),h=gs.getPreference("sys_update_set")==h,e!=\n' +
			'c||g&amp;&amp;!h?(b.conflict=!0,g="WARNING: This record is part of an active update set. Name: \'"+a+"\', created by: "+e+", created: ",b.conflict&amp;&amp;gs.addErrorMessage(0&gt;=d?g+"less than a day ago.":1==d?g+"1 day ago.":g+(d+" days ago."))):b.noConflictReason="Current user is the same account that created the update set."):b.noConflictReason="Current update set not in progress."):b.noConflictReason="Current update set is "+a;0===f.toLowerCase().indexOf("default")&amp;&amp;gs.hasRole("admin")&amp;&amp;l&amp;&amp;gs.addErrorMessage("WARNING: You have the \'"+\n' +
			'f+"\' update set selected. If you save this record, it will be associated with that update set.");b.updateSetName=a;b.updateSetOwner=e;b.daysAgo=d;return b}}else return b.updateSetValid=!1,b};';
			
			descriptionText = 'ServiceNow Guys - Update Set Collision Avoidance (USCA) tool.';
			
			
			gr.initialize();
			gr.setValue('name', this.nameOfScriptInclude);
			gr.setValue('script', scriptValue);
			gr.setValue('active', 'true');
			gr.setValue('description', descriptionText);
			gr.setValue('access', accessVal);
			gr.setValue('client_callable', clientCallableVal);
			scriptSysID = gr.insert();
		}
		return scriptSysID;
	},
	
	/**
		* @description Gets the list of tables that need conflict checker business rules created, 
		* by removing the tables listed in the "already done" variable, from the list of all tables
		* with the update_synch attribute.
		* @param {Array} [updateSynchTables] A list of all tables with the update_synch attribute (by sys_class_name).
		* @param {Array} [tablesAlreadyDone] A list of all the tables that already have a conflict avoidance business rule.
		* @returns {Array} A list of the delta between the first and second inputs.
		* @private
	*/
	getTablesToDo: function(updateSynchTables, tablesAlreadyDone) {
		//Return the complete list, if there are no tables already done, or if tablesAlreadyDone is not defined.
		if (!tablesAlreadyDone || (tablesAlreadyDone.length &lt; 1)) {
			return updateSynchTables;
		}
		var diffArray = new Array();
		var aut = new ArrayUtil();
		diffArray = aut.diff(updateSynchTables, tablesAlreadyDone);
		return diffArray;
	},
	
	/**
		* @description Checks if the relevant system properties exist in the system. If one or more does not exist, 
		* then setProperties creates it, and sets it to the default value (true). 
		* @returns {Boolean} Whether one or more of the system properties already existed. 
		* @private
	*/
	setProperties: function() {
		var pVal;
		var pDesc;
		var pType;
		var propName;
		var propCreated = false;
		var propPrefix = 'sncg.usca.';
		//Iterate over propHash, and do all that neat property creation stuff.
		for (propName in this.propHash) {
			//set vars for this property (propHash[propName]).
			pVal = this.propHash[propName]['value'];
			pType = this.propHash[propName]['type'];
			pDesc = this.propHash[propName]['description'];
			propCreated = (this.createProperty(propPrefix + propName, pType, pVal, pDesc) || propCreated);
		}
		return propCreated;
	},
	
	/**
		* @description Checks if a given property exists, and creates it if it does not.
		* @param {string} [propName] The name of the property (will be converted to lower-case)
		* @param {string} [propType] The property type - Must be one of the following:
		* boolean, string, integer, choicelist, short_string
		* @param {string} [propVal] The value of the property to be created (will be converted to 
		* lower case) 
		* @param {string} [descriptionText] The description of the property. 
		* @returns {Boolean} Whether or not a given property was created. 
		* This may be false if invalid params were passed in, or if the property already exists.
		* @private
	*/
	createProperty: function(propName, propType, propVal, descriptionText) {
		//sanitize
		propName = propName.toLowerCase();
		propType = propType.toLowerCase();
		propVal = propVal.toLowerCase();
		//declare
		var propSysID;
		var autil = new ArrayUtil();
		var validTypes = ['boolean', 'string', 'integer', 'choicelist', 'short_string'];
		var gr = new GlideRecord('sys_properties');
		//validate propType is one of the accepted types
		if (!autil.contains(validTypes, propType)) {
			return false;
		}
		//Check if property exists
		if (gr.get('name', propName)) {
			return false;
		}
		//Create it, if it doesn't.
		try {
			gr.initialize();
			gr.setValue('name', propName);
			gr.setValue('description', descriptionText);
			gr.setValue('type', propType);
			gr.setValue('value', propVal);
			propSysID = gr.insert();
			this.addToPropCategory(propSysID);
			return true;
		}
		catch (err) {
			gs.logError('ERROR in createProperty function during property creation. Error message: ' + err.message, 'USCA.createProperty');
			//Return false if there's an error in the try block.
			return false;
		}
	},
	
	createPropCategory: function() {
		var gr = new GlideRecord('sys_properties_category');
		if (gr.get('name', 'USCA')) {
			return gr.getValue('sys_id');
		}
		else {
			gr.initialize();
			gr.setValue('name', 'USCA');
			gr.setValue('title', '&lt;p&gt;Update Set Collision Avoidance Properties&lt;/p&gt;');
			return gr.insert();
		}
	},
	
	addToPropCategory: function(propSysID) {
		//check if the category exists. if not, create it.
		var catSysID = this.createPropCategory();
		//add prop to category using m2m entry
		var gr = new GlideRecord('sys_properties_category_m2m');
		gr.initialize();
		gr.setValue('category', catSysID);
		gr.setValue('property', propSysID);
		return gr.insert();
		//system_properties_ui.do?sysparm_title=Update%20Set%20Collision%20Avoidance%20Properties&amp;sysparm_category=usca
	},
	
	/**
		* @description Creates a business rule pseudopolymorphically for each table in tablesToDo, and 
		* returns an Array containing the sys_ids of each business rule that was created. 
		* Any errors that are generated, are handled within this function, and are logged but not returned. 
		* To find error logs generated by this function, look for logs beginning with "createBusinessRules Error: ".
		* @param {Array} [tablesToDo] An Array of all the tables that need business rules created to check for update set conflicts.
		* @returns {Array} An array of the sys_ids of all the business rules that were created from this function. 
		* @private
	*/
	createBusinessRules: function(tablesToDo) {
		var i;
		var tableName;
		var scriptValue = '(function executeRule(current, previous) { checkUpdateSetConflict(current); })(current, previous);';
		var whenValue = 'before_display';
		var advancedValue = 'true';
		var orderValue = '100';
		var businessRuleSysID;
		
		for (i = 0; i &lt; tablesToDo.length; i++) {
			//get table name from array
			tableName = tablesToDo[i];
			//Check if the business rule exists
			var gr = new GlideRecord('sys_script');
			gr.addQuery('name', this.nameOfBusinessRule);
			gr.addQuery('collection', tableName);
			gr.query();
			//only create a new business rule if this one does not already exist. 
			if (!gr.hasNext()) {
				try {
					//init record
					gr.initialize();
					//set hard-coded values
					gr.setValue('name', this.nameOfBusinessRule);
					gr.setValue('action_query', 'false');
					gr.setValue('action_delete', 'false');
					gr.setValue('active', 'true');
					//set var-coded values 
					gr.setValue('collection', tableName);
					gr.setValue('script', scriptValue);
					gr.setValue('when', whenValue);
					gr.setValue('advanced', advancedValue);
					gr.setValue('order', orderValue);
					//insert record, get sys id, party.
					businessRuleSysID = gr.insert();
				}
				catch (err) {
					gs.logError('ERROR: Failure in createBusinessRules function on table number ' + i + ': ' + tablesToDo[i] + '. Error message: ' + err.message, 'USCA.createBusinessRules');
				}
			}
		}
	},
	
	/**
		* This function will delete the ServiceNow Guys - Update Set Collision Avoidance (USCA) tool, and all associated records.
		* @param {Boolean} [areYouSure] This must be set to true to "confirm" that you want to delete this tool. Otherwise, it will abort.
		* @returns {Boolean} Whether or not the removal was a success.
	*/
	deleteUSCA: function(areYouSure) {
		if (areYouSure !== true) {
			return false;
		}
		try {
			this.deleteUSCABRs();
			this.deleteUSCASIs();
			this.deleteUSCAProps();
		}
		catch (err) {
			gs.logError('ERROR: deleteUSCA function encountered the following error while attempting to delete the update set conflict avoidance tool: ' + err.message, 'USCA deletion script: deleteUSCA function');
			return false;
		}
		gs.log('Successfully removed the ServiceNow Guys - Update Set Collision Avoidance (USCA) tool.');
		return true;
	},
	
	/**
		* @private
	*/
	deleteUSCABRs: function() {
		try {
			var gr = new GlideRecord('sys_script');
			gr.addQuery('name', 'STARTSWITH', this.nameOfBusinessRule);
			gr.deleteMultiple();
			return true;
		}
		catch (err) {
			gs.logError('ERROR deleting USCA business rules: ' + err.message, 'USCA deletion script: _deleteUSCABRs function');
			return false;
		}
	},
	
	/**
		* @private
	*/
	deleteUSCASIs: function() {
		try {
			var gr = new GlideRecord('sys_script_include');
			gr.addQuery('name', 'STARTSWITH', this.nameOfScriptInclude);
			gr.deleteMultiple();
			return true;
		}
		catch (err) {
			gs.logError('ERROR deleting USCA script includes: ' + err.message, 'USCA deletion script: _deleteUSCASIs function');
			return false;
		}
	},
	
	/**
		* @private
	*/
	deleteUSCAProps: function() {
		try {
			var propPrefix = 'sncg.usca.';
			var gr = new GlideRecord('sys_properties');
			gr.addQuery('name', 'STARTSWITH', propPrefix);
			gr.deleteMultiple();
			return true;
		}
		catch (err) {
			gs.logError('ERROR deleting USCA properties: ' + err.message, 'USCA deletion script: _deleteUSCAProps function');
			return false;
		}
	},
	
	type: 'USCAInstaller'
};

]]&gt;&lt;/script&gt;&lt;sys_class_name&gt;sys_script_include&lt;/sys_class_name&gt;&lt;sys_created_by&gt;admin&lt;/sys_created_by&gt;&lt;sys_created_on&gt;2016-03-19 22:53:43&lt;/sys_created_on&gt;&lt;sys_customer_update&gt;true&lt;/sys_customer_update&gt;&lt;sys_id&gt;ee7dcecd4f92d200bf004a318110c764&lt;/sys_id&gt;&lt;sys_mod_count&gt;13&lt;/sys_mod_count&gt;&lt;sys_name&gt;USCAInstaller&lt;/sys_name&gt;&lt;sys_package display_value="Global" source="global"&gt;global&lt;/sys_package&gt;&lt;sys_policy/&gt;&lt;sys_replace_on_upgrade&gt;false&lt;/sys_replace_on_upgrade&gt;&lt;sys_scope display_value="Global"&gt;global&lt;/sys_scope&gt;&lt;sys_update_name&gt;sys_script_include_ee7dcecd4f92d200bf004a318110c764&lt;/sys_update_name&gt;&lt;sys_updated_by&gt;admin&lt;/sys_updated_by&gt;&lt;sys_updated_on&gt;2016-03-20 00:14:39&lt;/sys_updated_on&gt;&lt;/sys_script_include&gt;&lt;/record_update&gt;</payload>
<remote_update_set display_value="Update Set Conflict Checker V2.0.1">917b87014f16d200bf004a318110c7cd</remote_update_set>
<replace_on_upgrade>false</replace_on_upgrade>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2016-03-20 03:24:31</sys_created_on>
<sys_id>197b87014f16d200bf004a318110c7cd</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2016-03-20 03:24:31</sys_updated_on>
<table/>
<target_name>USCAInstaller</target_name>
<type>Script Include</type>
<update_domain>global</update_domain>
<update_set display_value=""/>
<view/>
</sys_update_xml>
<sys_update_xml action="INSERT_OR_UPDATE">
<action>INSERT_OR_UPDATE</action>
<application display_value="Global">global</application>
<category>customer</category>
<comments/>
<name>sys_app_module_b51e310d4f92d200bf004a318110c79e</name>
<payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update sys_domain="global" table="sys_app_module"><sys_app_module action="INSERT_OR_UPDATE"><active>true</active><application display_value="ServiceNow Guys">8e7dfdc94f92d200bf004a318110c7d8</application><assessment/><content_page/><device_type/><filter/><hint>USCA Tool</hint><homepage/><image/><link_type>SEPARATOR</link_type><map_page/><mobile_title>Update Set Collision Avoidance (USCA)</mobile_title><mobile_view_name>Mobile</mobile_view_name><name/><order>100</order><override_menu_roles>false</override_menu_roles><query/><report/><roles/><survey/><survey_overwrite>true</survey_overwrite><sys_class_name>sys_app_module</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>2016-03-19 21:46:52</sys_created_on><sys_customer_update>true</sys_customer_update><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>b51e310d4f92d200bf004a318110c79e</sys_id><sys_mod_count>2</sys_mod_count><sys_name>Update Set Collision Avoidance</sys_name><sys_overrides/><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_replace_on_upgrade>false</sys_replace_on_upgrade><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_app_module_b51e310d4f92d200bf004a318110c79e</sys_update_name><sys_updated_by>admin</sys_updated_by><sys_updated_on>2016-03-19 23:49:04</sys_updated_on><timeline_page/><title>Update Set Collision Avoidance</title><uncancelable>false</uncancelable><view_name/><window_name/></sys_app_module></record_update>]]></payload>
<remote_update_set display_value="Update Set Conflict Checker V2.0.1">917b87014f16d200bf004a318110c7cd</remote_update_set>
<replace_on_upgrade>false</replace_on_upgrade>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2016-03-20 03:24:31</sys_created_on>
<sys_id>557b87014f16d200bf004a318110c7cd</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2016-03-20 03:24:31</sys_updated_on>
<table/>
<target_name>Update Set Collision Avoidance</target_name>
<type>Module</type>
<update_domain>global</update_domain>
<update_set display_value=""/>
<view/>
</sys_update_xml>
<sys_update_xml action="INSERT_OR_UPDATE">
<action>INSERT_OR_UPDATE</action>
<application display_value="Global">global</application>
<category>customer</category>
<comments/>
<name>sys_app_module_c7645a814fd2d200bf004a318110c76e</name>
<payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update sys_domain="global" table="sys_app_module"><sys_app_module action="INSERT_OR_UPDATE"><active>true</active><application display_value="ServiceNow Guys">8e7dfdc94f92d200bf004a318110c7d8</application><assessment/><content_page/><device_type/><filter/><hint>Completely remove the Update Set Collision Avoidance tool, including all related scripts and system properties.</hint><homepage/><image/><link_type>SCRIPT</link_type><map_page/><mobile_title>Uninstall USCA Tool</mobile_title><mobile_view_name>Mobile</mobile_view_name><name/><order>300</order><override_menu_roles>false</override_menu_roles><query>try {&#13;
	gs.print('Initializing USCA Installer...');&#13;
	var usca = new USCAInstaller();&#13;
	gs.print('Uninstalling USCA...');&#13;
	usca.uninstallUSCA();&#13;
	gs.addInfoMessage('USCA tool has been uninstalled.');&#13;
}&#13;
catch(err) {&#13;
	gs.addErrorMessage('Error detected while uninstalling the USCA tool. Check the system error logs for more details.');&#13;
	gs.log('USCA error detected while uninstalling: ' + err.message);&#13;
}</query><report/><roles/><survey/><survey_overwrite>true</survey_overwrite><sys_class_name>sys_app_module</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>2016-03-19 23:29:11</sys_created_on><sys_customer_update>true</sys_customer_update><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>c7645a814fd2d200bf004a318110c76e</sys_id><sys_mod_count>2</sys_mod_count><sys_name>Uninstall USCA Tool</sys_name><sys_overrides/><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_replace_on_upgrade>false</sys_replace_on_upgrade><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_app_module_c7645a814fd2d200bf004a318110c76e</sys_update_name><sys_updated_by>admin</sys_updated_by><sys_updated_on>2016-03-19 23:49:39</sys_updated_on><timeline_page/><title>Uninstall USCA Tool</title><uncancelable>false</uncancelable><view_name/><window_name/></sys_app_module></record_update>]]></payload>
<remote_update_set display_value="Update Set Conflict Checker V2.0.1">917b87014f16d200bf004a318110c7cd</remote_update_set>
<replace_on_upgrade>false</replace_on_upgrade>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2016-03-20 03:24:31</sys_created_on>
<sys_id>957b87014f16d200bf004a318110c7cd</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2016-03-20 03:24:31</sys_updated_on>
<table/>
<target_name>Uninstall USCA Tool</target_name>
<type>Module</type>
<update_domain>global</update_domain>
<update_set display_value=""/>
<view/>
</sys_update_xml>
<sys_update_xml action="INSERT_OR_UPDATE">
<action>INSERT_OR_UPDATE</action>
<application display_value="Global">global</application>
<category>customer</category>
<comments/>
<name>sys_app_application_8e7dfdc94f92d200bf004a318110c7d8</name>
<payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update sys_domain="global" table="sys_app_application"><sys_app_application action="INSERT_OR_UPDATE"><active>true</active><category display_value="Custom Applications">e0355b31ef303000a61d5a3615c0fb78</category><description>Applications and Tools designed by The ServiceNow Guys.</description><device_type>browser</device_type><hint>Applications and Tools designed by The ServiceNow Guys</hint><name/><order>100</order><roles>security_admin</roles><sys_class_name>sys_app_application</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>2016-03-19 21:44:48</sys_created_on><sys_customer_update>true</sys_customer_update><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>8e7dfdc94f92d200bf004a318110c7d8</sys_id><sys_mod_count>2</sys_mod_count><sys_name>ServiceNow Guys</sys_name><sys_overrides/><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_replace_on_upgrade>false</sys_replace_on_upgrade><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_app_application_8e7dfdc94f92d200bf004a318110c7d8</sys_update_name><sys_updated_by>admin</sys_updated_by><sys_updated_on>2016-03-19 23:48:52</sys_updated_on><title>ServiceNow Guys</title><view_name/></sys_app_application></record_update>]]></payload>
<remote_update_set display_value="Update Set Conflict Checker V2.0.1">917b87014f16d200bf004a318110c7cd</remote_update_set>
<replace_on_upgrade>false</replace_on_upgrade>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2016-03-20 03:24:31</sys_created_on>
<sys_id>d17b87014f16d200bf004a318110c7cd</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2016-03-20 03:24:31</sys_updated_on>
<table/>
<target_name>ServiceNow Guys</target_name>
<type>Application Menu</type>
<update_domain>global</update_domain>
<update_set display_value=""/>
<view/>
</sys_update_xml>
<sys_update_xml action="INSERT_OR_UPDATE">
<action>INSERT_OR_UPDATE</action>
<application display_value="Global">global</application>
<category>customer</category>
<comments/>
<name>sys_app_module_e26ef10d4f92d200bf004a318110c77b</name>
<payload><![CDATA[<?xml version="1.0" encoding="UTF-8"?><record_update sys_domain="global" table="sys_app_module"><sys_app_module action="INSERT_OR_UPDATE"><active>true</active><application display_value="ServiceNow Guys">8e7dfdc94f92d200bf004a318110c7d8</application><assessment/><content_page/><device_type/><filter/><hint>Install USCA Tool</hint><homepage/><image/><link_type>SCRIPT</link_type><map_page/><mobile_title>Install USCA Tool</mobile_title><mobile_view_name>Mobile</mobile_view_name><name/><order>200</order><override_menu_roles>false</override_menu_roles><query>gs.print('Invoking installer...');&#13;
var usca = new USCAInstaller();&#13;
gs.print('Installing...');&#13;
usca.installUSCA();&#13;
gs.print('Finished.');</query><report/><roles/><survey/><survey_overwrite>true</survey_overwrite><sys_class_name>sys_app_module</sys_class_name><sys_created_by>admin</sys_created_by><sys_created_on>2016-03-19 21:56:15</sys_created_on><sys_customer_update>true</sys_customer_update><sys_domain>global</sys_domain><sys_domain_path>/</sys_domain_path><sys_id>e26ef10d4f92d200bf004a318110c77b</sys_id><sys_mod_count>6</sys_mod_count><sys_name>Install USCA Tool</sys_name><sys_overrides/><sys_package display_value="Global" source="global">global</sys_package><sys_policy/><sys_replace_on_upgrade>false</sys_replace_on_upgrade><sys_scope display_value="Global">global</sys_scope><sys_update_name>sys_app_module_e26ef10d4f92d200bf004a318110c77b</sys_update_name><sys_updated_by>admin</sys_updated_by><sys_updated_on>2016-03-19 23:49:23</sys_updated_on><timeline_page/><title>Install USCA Tool</title><uncancelable>false</uncancelable><view_name/><window_name>Install USCA</window_name></sys_app_module></record_update>]]></payload>
<remote_update_set display_value="Update Set Conflict Checker V2.0.1">917b87014f16d200bf004a318110c7cd</remote_update_set>
<replace_on_upgrade>false</replace_on_upgrade>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2016-03-20 03:24:31</sys_created_on>
<sys_id>d57b87014f16d200bf004a318110c7cd</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2016-03-20 03:24:31</sys_updated_on>
<table/>
<target_name>Install USCA Tool</target_name>
<type>Module</type>
<update_domain>global</update_domain>
<update_set display_value=""/>
<view/>
</sys_update_xml>
</unload>
