Skip to main content

Posts

Clearing cache and sys properties (GlidePropertiesDB)

Found a weird situation where the cache did not clear after updating a property through the versions related list (choosing 'Revert to this version' option), so the incorrect value is still retained in the cache. If you do come across a similar behaviour and want to see what is in the cache you can run GlideProperties.dump(); in Scripts Background. Then you look for the property of interest and compare it to what the value is in the sys_properties table. Whenever a property is inserted, updated or deleted the instance will do a cache flush, which is rather extreme in my view. So, to fix the issue, ran GlidePropertiesDB.invalidate(); in Scripts Background, which does a quick property refresh.  

GlideModalConfirm on an onsubmit client script (not for service portal)

This script achieves the following: - display a user friendly modal - return false if cancel clicked, without saving the form - return true if OK clicked, and save the form - return true if the conditions for displaying the dialog message are false it's a little more tricky with onsubmit due to asynchronous transactions not being possible! [See related post for onchange client script which is asynch friendly: dialog with callback ] var _canSubmit = false ; var _dialog; function onSubmit () { if ( _canSubmit ) { return true ; } /* */ //Check for Assignment Group if ( g_form . getValue ( 'assignment_group' ) == g_scratchpad . assignmentGroup && g_scratchpad . serviceOfferingABC == true ) { var wNote = g_form . getValue ( 'work_notes' ); //If Work note updated if ( wNote != '' && wNote != null ) { //Alert user to remove any Sensitiv...

ServiceNow Running your own health scan, for improved reporting of culprit objects

ServiceNow Running your own health scan, for improved reporting of culprit objects  (c) Shahed Shah --- /** * Name: Config Review Script * Created: 2019-07-19 * Author: Shahed Ali Shah @ Cloudefy Ltd * Usage: Inside the *process* function, uncomment the function for the intended review * Do not run all the functions. */ var reviewScript = { WHITELIST : [ 'sys_script_fix' , 'clone_cleanup_script' ], // of tables when running performMatch or findMatch process : function () { // WARNING - Try to reduce how many heavy scripts you run at once //this.hardCodedSysIDs(); // HEAVY: Hard-coded Sys IDs in Server-Side Scripts // this.ohardCodedSysIDs([ // { // table: 'sys_script', // field: 'script', // query: 'active=true' // }, // { // table: 'sys_script_include', // fi...