Posts

Showing posts from October, 2021

Create a general request button on agent workspace to take users to a general request item

Image
  script : function onClick () { var params = {}; params . sysparm_parent_table = "interaction" ; params . sysparm_parent_sys_id = g_form . getUniqueValue (); //params.sysparm_software_requirements = current.short_descritpion; var paramsJSON = JSON . stringify ( params ); var request = new GlideAjax ( 'RequestLinkSessionManager' ); request . addParam ( 'sysparm_name' , 'setComponentSessionValueMapJSON' ); request . addParam ( 'workspace_request_session_data' , paramsJSON ); request . getXMLAnswer ( function ( answer ){ onSubmitAfterSessionPut ( params ); }); } function onSubmitAfterSessionPut ( params ) { var result = g_form . submit ( 'sysverb

Event Management: Quick Incident button

 This can be used to create manual incidents

Service Request - Cart API / generate request programmatically

  see the docs   var cart = new sn_sc . CartJS (); var item = { 'sysparm_id' : '0d08837237153000158bbfc8bcbe5d02' , 'sysparm_quantity' : '1' , 'variables' :{ 'carrier' : 'at_and_t_mobility' , 'data_plan' : '500MB' , 'duration' : 'eighteen_months' , 'color' : 'slate' , 'storage' : 'sixtyfour' }}; //var cartDetails = cart . addToCart ( item );   var cartDetails = cart . orderNow ( request ); gs . info ( JSON . stringify ( cartDetails )); //-- in case of errors, this will throw the error: gs.print(JSON.stringify(cartDetails));     try also the submitOrder() and orderNow() functions  or this format: gs . include ( 'Cart' ); var cart = new Cart (); var item = cart . addItem ( 'd95447ce1b973010987d1fc3b24bcba0' ); cart . setVariable ( item , 'short_description' , 'test' ); cart . setVariable ( item

Background script to identify all empty CMDB tables

var gr = new GlideRecord ( 'sys_db_object' ); gr . addEncodedQuery ( 'nameSTARTSWITHcmdb' ); gr . query (); var count = 0 ; while ( gr . next ()) { var cgr = new GlideAggregate ( gr . name ); cgr . addAggregate ( 'COUNT' ); cgr . query (); while ( cgr . next ()){ count = cgr . getAggregate ( 'COUNT' ); if ( count == 0 ) gs . print ( 'Name: ' + gr . name + ' Records: ' + count ); } }

IP whitelisting for integrations / finding the IP range for the instance (KBs)

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0679421   https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0538621

Event Management: alter the run remediation options that appear under Quick Responses

Image
     to get your custom sub-flow to appear under the run remediation box, go to the following alert management rule:      then go into the actions tab, scroll down to the remediation subflows list and replace the OOTB with your custom flow, ensure the execution is set to 'manual'