Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Please explain what is of GlideImportSetTransformerWorker API

Mohan raj
Mega Sage

Hi,

I was confuse of this Knowledge article. please can anyone explain In details about this article

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0781666

 

 

and what is purpose of the code below in the same article

 

transformAsyncIset();

function transformAsyncIset() {
    var igr = new GlideRecord("sys_import_set");
    igr.addQuery("mode", "asynchronous");
    igr.addQuery("table_name", "STAGING_TABLE_NAME");
    igr.addQuery("state", "loading");
    igr.query();
    while (igr.next()) {
        sTransform(igr);
    }
}

function sTransform(igr) {
    var mapsList = getMap(igr.table_name);

    var t = new GlideImportSetTransformerWorker(igr.sys_id, mapsList);
    t.setProgressName("Transforming: " + igr.number);
    t.setBackground(true);
    t.start();
}

function getMap(sTable) {
    var mapGR = new GlideRecord("sys_transform_map");
    mapGR.addQuery("source_table", sTable);
    mapGR.addActiveQuery();
    mapGR.query();

    var mapsList = [];
    while (mapGR.next())
        mapsList.push(mapGR.getUniqueValue());

    return mapsList.join();
}

 

1 REPLY 1

Omkar Kumbhar
Mega Sage

Hello @Mohan raj ,

Please find the below link

https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server/GlideImportSetTransformerAPI

 

The above code is basically loading, mapping and transforming the data.

 

Thank you,

Omkar

 

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.