Run transform in server side script

sumeet_n
Kilo Guru

Hello All,

Is there any way to "run transforms" in server side script? any APIs?

14 REPLIES 14

srinivasthelu
Tera Guru

  SncTriggerSynchronizer.executeNow(rec);




Look at this thread for more details :Re: Is it possible to kick off a schedule import from a script?


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Sumeet,



You may find the below thread helpful.


Re: Is it possible to kick off a schedule import from a script?


The SN Nerd
Giga Sage
Giga Sage

Example code:


igr = your import set GlideRecord


transformMap = your transfrom map GlideRecord



var t = new GlideImportSetTransformerWorker(igr.sys_id, transformMap.sys_id);


  t.setProgressName("Transforming: " + igr.number + " using map " + transformMap.name);


  t.setBackground(true);


  t.start();



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Hi Paul, how did you create a GlideRecod of the trasnform map? This is what I have been trying:



function transform(){


        var imports = [];


        var record = new GlideRecord('demo_import');


        record.query();


        imports.push(record);




        var tables = [];


        var target = new GlideRecord('Demo transform');


        target.query();


        while(record.next())


        tables.push(target);


}



I am attempting to put the import set in an array and the transform map in an array. 'demo_import' is the name of the import set and 'Demo transform' is the name of the transform map.