Skip to main content

Posts

Showing posts with the label transform maps

ServiceNow Transform Maps: check if all rows in the import staging table match the target rows

 ServiceNow Transform Maps: check if all rows in the import staging table match the target rows //--t-map on complete script accountTableTrueUp ( import_set . number ); //accountTableTrueUp('ISET0011535'); function accountTableTrueUp ( import_set_number ) { var flat_file_arr = []; var grST = new GlideRecord ( 'x_cls_clear_skye_i_eon_hr_import' ); //--the staging table name of the transform grST . addEncodedQuery ( 'sys_import_set.number=' + import_set_number ); grST . query (); while ( grST . next ()) { //gs.print('employee number:' + grST.u_employeenumber); //flat_file_arr.push(grST.sys_target_sys_id+''); flat_file_arr . push ( grST . u_employeenumber + '' ); } gs . print ( 'flat_file_arr=' + flat_file_arr . toString ()); var arrStr = flat_file_arr . toString (); var grAC = new GlideRecord ( 'x_cls_clear_...

ServiceNow Accessing the import_set api in a Transform Map Script

ServiceNow Accessing the import_set api in a Transform Map Script  link:  https://developer.servicenow.com/dev.do#!/reference/api/utah/rest/c_ImportSetAPI how you could loop through target records in an onComplete t-map script: (Change the staging table name to your import set table, or alternatively use sys_import_set) var grST = new GlideRecord ( 'x_cls_clear_skye_i_eon_hr_import' ); grST . addEncodedQuery ( 'sys_import_set.number=' + import_set . number ); grST . query (); while ( grST . next ()) { gs . warn ( 'row--' + grST . sys_target_sys_id ); }

ServiceNow Transform Map - prevent a particular row from being processed

 ServiceNow Transform Map - prevent a particular row from being processed example 'run script' code ( function transformRow ( source , target , map , log , isUpdate ) { if ( action == 'insert' && source . u_status == 'I' ){ gs . warn ( source . u_employeenumber + ' row ignored-disable on insert is not required::T-MAP' ); ignore = true ; } })( source , target , map , log , action === "update" );