Posts

Showing posts from September, 2018

Consuming a staging table endpoint & transform map using REST

Image
whilst below works, developer site actually recommends the format: /api/now/import/<staging table_name> https://developer.servicenow.com/app.do#!/rest_api_doc?v=kingston&id=c_ImportSetAPI ------------------- web service endpoint created in a remote ServiceNow instance via system web services> create new, where the staging table name is  u_staging_table_xyz  and the requests are processed to the target table via a transform map SOAP wsdl to consume from another ServiceNow instance might be     https://<servicenowinstance>.service-now.com/u_staging_table_xyz.do?WSDL format for consuming this on REST would be:     https://<servicenowinstance>.service-now.com/ api/now/table/ u_staging_table_xyz   Example test harness for a POST operation  go to REST messages and create a new REST message as a test harness, and create a new http POST method: set up a basic authentication profile and configure the authentication profile to use as crede

"Filtering CI's: A Reference Qualifier Example"

https://community.servicenow.com/community?id=community_blog&sys_id=7b3139aedb9b9f002be0a851ca961909

ServiceNow cloning "partial clone of task table"

https://community.servicenow.com/community?id=community_blog&sys_id=b19f959fdb10a7c8a39a0b55ca9619a2

ServiceNow "rollback" features

https://docs.servicenow.com/bundle/london-platform-administration/page/administer/table-administration/concept/rollback-delete-recovery.html

Bit of code I was looking at

var gdtBST = new GlideDateTime (); var tz = Packages . java . util . TimeZone . getTimeZone ( "Europe\London" ); gdtBST . setTZ ( tz ); gdtBST . setDisplayValue ( current . getDisplayValue ( 'opened_at' )); var dT = gdtBST . toString (); var dateSection = dT . split ( ' ' )[ 0 ]; //Gets the Date var timeSection = dT . split ( ' ' )[ 1 ]; //Gets the Time current . u_call_log_date = dateSection ; current . u_call_log_time = timeSection ;

AJAX call example 2: return single value

AJAX call example 2: return single value Client script code: //--author: RDS Feb 2018 function  onChange ( control ,  oldValue ,  newValue ,  isLoading )   {      if   ( isLoading  ||  newValue  ==   '' )   {          // return;      }      var ga = new GlideAjax ( 'fj_servicerequest_ajax' );     ga . addParam ( 'sysparm_name' , 'refreshItemDescription' );     ga . addParam ( 'sysparm_req_type' , newValue );     ga . addParam ( 'sysparm_req_category' , g_form . getValue ( 'fj_request_category' ));     ga . addParam ( 'sysparm_req_subcategory' ,            g_form . getValue ( 'fj_request_subcategory' ));      ga . getXMLAnswer ( function ( answer ) {           //alert('AJAX return:' + answer);          g_form . setValue ( 'fj_request_shortdescription' , answer );      });      } } Script include script (client callable): var  my_ajax_funcs_sc  =

Perspectium: determine if create or update in before share script

use  current.operation()

Perspectium: script an ignore condition in a dynamic share

Image
enter the additional filter in the 'before share script' section of the outbound dynamic share:

Client scripting: disable options from a dropdown

(courtesy of ServiceNow Guru: https://www.servicenowguru.com/scripting/client-scripts-scripting/removing-disabling-choice-list-options/ ) //--remove the state options from the dropdown     var control = g_form . getControl ( 'state' );     var options = control . options ;     for ( var i = 0 ; i < options . length ; i ++) {         var option = options [ i ];         var ov = option . value ;                 if ( ov != '-24' ) {             control . options [ i ]. disabled = 'true' ;         }             }

Perspectium: work notes duplicates niggle

Scenario : a duplicate worknote ends up getting written whereby an extra update transaction from Perspectium containing the following in the xml is sent     <work_notes>_123 STREAMENTRY 321_original worknotes entered</work_notes> Not too sure how this has come about but the steps to create it were reproducible Create problem ticket in ServiceNow instance 1 and send to  ServiceNow instance 2 Wait until number returned to  ServiceNow instance 1 from ServiceNow instance 2 Go into  ServiceNow instance 2 Enter a comment, cick ‘post’, then immediately change the state to <some value>, click save fix: include some error trapping in a try>catch within the inbound transform map to ultimately set the row to ignore=true var iWN_err = source . u_work_notes . toUpperCase (). indexOf ( 'STREAMENTRY' ); if ( iWN_err >- 1 ){                         //--known error whereby the worknote has arrived as a duplicate jumbled string

Adding an attachment to an outbound notification (Istanbul)

https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/administer/notification/concept/c_AttachingDocsToANotification.html notifications email script - uses interim integrations attachments table attachLinks (); function attachLinks () {     //Check if there are attachments to be sent     var intAttach = new GlideRecord ( 'u_task_integration_attachments' );     intAttach . addQuery ( 'u_task' , current . sys_id );     intAttach . addQuery ( 'u_vendor' , gs . getProperty ( 'zzzz.vendor.sys_id' ));     intAttach . addQuery ( 'u_send_attachment' , 'true' );     intAttach . query ();       if ( intAttach . hasNext ()) {       template . print ( "Attachments: <br />" );       while ( intAttach . next ()) {          var attachLink = '<a href="' + gs . generateURL ( 'sys_attachment' , intAttach . u_attachment_file_sysid ) +   &