Skip to main content

Posts

Showing posts from November, 2026

ServiceNow how to free up a flow with wait for message block by broadcasting the message

ServiceNow how to free up a flow with wait for message block by broadcasting the message see my other post ' ServiceNow flow waiting for another flow ' post   http://www.cloudminus89.com/2026/07/servicenow-flow-waiting-for-another-flow.html this mentions a community post: https://www.servicenow.com/community/developer-blog/sending-message-to-an-active-flow-from-outside-of-context/ba-p/3194739  in below code examples, the flow wait for message block is expecting a value of  'onboarding_flow_resume' expanded: option 1 if you know the workflow context, pass it var wfcontext = <executing_context_sysid> + '' ; var flowMsg = 'onboarding_flow_resume' ; var res = sn_fd . FlowAPI . sendMessage ( wfcontext , flowMsg , '' ); option 2 if you don't know the workflow context, retrieve it using the source record sys id: for this option, you need...

ServiceNow Execute Flow From Script (With Parameters)

 ServiceNow Execute Flow From Script (With Parameters) note you can click the 3 dots in flow designer to auto generate a script example code: try { var sIDRsysid = '51ce689afb4c9b501a3ffee7aeefdcde' ; var inputs = {}; //inputs['request_plan'] = ''; // GlideRecord of table: x_cls_clear_skye_i_request_plan inputs [ 'iga_request' ] = '7ea6ddd5fbe453901a3ffee7aeefdcba' ; // String gs . info ( 'fixScr:checkIsDayXmas::test2' ); // Start Asynchronously: Uncomment to run in background. Code snippet will not have access to outputs. //var result = msn_fd.FlowAPI.getRunner().subflow('x_cls_clear_skye_i.osb_onboarding_idr_check_dec25th').inBackground().withInputs(inputs).run(); // Execute Synchronously: Run in foreground. Code snippet has access to outputs. var result = sn_fd . FlowAPI . getRunner (). subflow ( 'x_cls_clear_skye_i.onboarding_idr_check_dec25th' ...

ServiceNow Add a Clickable URL in a gs.addInfoMessage via Display Business Rule

 ServiceNow Add a Clickable URL in a gs.addInfoMessage via Display Business Rule var linkComment = '' ; //--locate the Profile Disable request var grIDRdisable = new GlideRecord ( "x_cls_clear_skye_i_identity_operations" ); grIDRdisable.addQuery( 'request_ref' , 'cb4e7546dbaba380ef2c1fc76896195f' ); //--profile disable grIDRdisable.addQuery( 'profile' , current.profile); //--profile disable grIDRdisable.query(); if (grIDRdisable.next()) { var urlPrefix= 'nav_to.do?uri=x_cls_clear_skye_i_identity_operations.do?sys_id=' linkComment = '. See <a href="' + urlPrefix + grIDRdisable.sys_id + '" target="_blank" >' + grIDRdisable.number + '</a>' ; } gs.addInfoMessage(gs.getMessage( 'osb.clearskye.osbindia.approvalIDR.rejected' ) + linkComment);

ServiceNow adding your own function to GlideForm (g_form)

 ServiceNow adding your own function to GlideForm (g_form) for example, onChange client script: function onChange(control, oldValue, newValue, isLoading, isTemplate) { g_form. connectorChange (newValue, isLoading); } the function is defined in another global, onload client script: self.g_form. connectorChange = function (newValue, isLoading) { try { if (isLoading) { setConnectorFields(); } else { var environmentGA = new GlideAjax ( "x_cls_clear_skye_i.IGASetupAjax" ); environmentGA.addParam( 'sysparm_name' , 'getConnectorSettings' ); environmentGA.addParam( 'sysparm_id' , newValue); environmentGA.getXMLAnswer( function (answer) { g_scratchpad. IGA . Connector = JSON .parse(answer); setConnectorFields(); }); } } catch (e) {} };

ServiceNow override display value of a reference field from a different table (not parent table) on a form

ServiceNow override display value of a reference field from a different table (not parent table) on a form (note: switch to GlideAjax rather than getReference for better performance)  using onload client script: var FIELD = 'cost_center_cmn'; var sysId = g_form.getValue(FIELD); if (!sysId) return; // Async lookup of the cost center record; callback runs once it arrives g_form.getReference(FIELD, function(ref) { if (!ref) return; var name = ref.name || ''; g_form.setValue(FIELD, sysId, name); }); https://www.servicenow.com/community/in-other-news/the-async-fight-getreference-and-gliderecord/ba-p/2267223