Skip to main content

Posts

Showing posts from July, 2018

Preserving integrations credentials

In addition to data preservers, consider the credential & alias features that Kingston makes available: https://docs.servicenow.com/bundle/kingston-release-notes/page/release-notes/it-operations-management/credentials-rn.html https://docs.servicenow.com/bundle/kingston-servicenow-platform/page/product/discovery/concept/connection-alias.html https://docs.servicenow.com/bundle/kingston-servicenow-platform/page/product/discovery/reference/connection-information.html

System maintenance: clear down email logs on sub-production

instURL= gs.getProperty('glide.servlet.uri'); if (instURL.indexOf('https://PROD.service-now.com') > -1) { //--NOT TO BE RUN ON PRODUCTION         gs.print('do not run on prod');     }else{ var gr = new GlideRecord ( 'sys_email' ); gr . addQuery ( 'type!=received^ORtype=NULL' ); //gr.query(); //gs.print(gr.getRowCount()); gr . deleteMultiple () }

Client script: make all editable fields read only under certain conditions

A write ACL is the ideal solution, but if for some reason this logic had to happen in a client script here is an (undocumented) solution: var fields = g_form . getEditableFields (); for ( var x = 0 ; x < fields . length ; x ++) {         g_form . setReadOnly ( fields [ x ], true ); } Seems to have left the worknotes editable on the form I tried it on which could be quite neat if that is the only field that should be editable. will not work on mandatory fields if these are empty

Get the table name based on ticket number

getTableName : function ( ticketNumber ){         var tableName = '' ;         var ticketPrefix = ticketNumber . replace ( /\d*/g , '' );         if ( ticketPrefix == 'INC' ){             tableName = 'incident' ;         }         if ( ticketPrefix == 'PRB' ){             tableName = 'problem' ;         }         if ( ticketPrefix == 'PRB' ){             tableName = 'problem' ;         }         if ( ticketPrefix == 'CHG' ){          ...