Skip to main content

Posts

Showing posts from November, 2022

ServiceNow Dynatrace Maintenance Window integration: ensuring the start/end times are clock change resistant

 script include code: startS = grcOutage . begin ; startS = this . utcUpdateTime ( startS ); endS = grcOutage . end ; endS = this . utcUpdateTime ( endS ); utcUpdateTime : function ( dTime ) { this . _dLog ( " utcUpdateTime is Called" ); var dateTime = dTime ; //check if dateTime is diff from Approval Date Time dateTime = this . checkApprovDateTime ( dTime ); this . _dLog ( " utcUpdateTime dTime =" + dTime + " ---- dateTime = " + dateTime ); var newdateTime = new GlideDateTime ( dateTime ); var yourDST = this . _utcTimeZone (); if ( yourDST == 'UTC+00:00' ) { //No Change to reported value } else { gs . log ( yourDST + 'dynatraceDST' ); newdateTime . addSeconds ( 3600 ); } newdateTime = newdateTime . toString (); newdateTime = newdateTime . repl...

ServiceNow picking up the SMS from major incident workbench and adding it to the incident activity trail

 Business rule:         script:   ( function executeRule ( current , previous /*null when async*/ ) { do_sleep ( 5000 ); function do_sleep ( milliseconds ) { var start = new Date (). getTime (); for ( var i = 0 ; i < 1e7 ; i ++) { if (( new Date (). getTime () - start ) > milliseconds ) { break ; } } } var notifyMsg = new GlideRecord ( 'notify_message' ); notifyMsg . addQuery ( 'source' , current . sys_id ); notifyMsg . addEncodedQuery ( 'sys_created_on>=javascript:gs.beginningOfLastMinute()' ); notifyMsg . query (); if ( notifyMsg . next ()) { var inc = new GlideRecord ( 'incident' ); inc . addQuery ( 'sys_id' , notifyMsg . source . incident_alert . source_incident ); inc . query (); if ( inc . next ()) { var msg = notifyMsg ...