PERSPECTIUM: how to return the target ticket number when the source system inserts a ticket

transform map: onAfter script

//--return the MAB number to TSFNow
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
    var logSource=':TMAP:AFTER-SRIPT:INC';
    var logPrefix=' [ number: ' + source.u_number + ';  number' + source.u_correlation_display + '] ';
    if (action=='update' && target.u_vendor=='91c6f451371e420041c5616043990eee'){
        if (target.state==6 && target.u_vendor_reference_number==''){ //--Fujitsu
            //--update the vendor ref number
            //-- ......
            var grInc=new GlideRecord('incident');
            if (grInc.get('number', source.u_number)){
    if (source.sys_import_state == 'ignored'){
        //--allow the vendor ref number to update, if missing before
        gs.log(logPrefix, '--onafter skipped', logPrefix);
        //--carry on:
        if (action=='insert' || gs.nil(source.u_correlation_display)){
            var pspR = new PerspectiumReplicator();pspR.shareRecord(current, 'incident', '', '36709489372a93008ca1138943990efb');
})(source, map, log, target);


Popular posts from this blog

Running transform maps asynchronously

GlideRecord setValue

Post a command to the ECC queue for the mid server to initiate a powershell file copy