Notifications

73 views

Description

When a web service import set having multiple associated transform maps is run in ASYNC mode via the schedule script execution 'Asynchronous Import Set Transformer', only one transform map is executed.

Steps to Reproduce

  1. Create an import set table 'u_web_service_import'.
  2. Create two transform maps for this import set table with different orders.
  3. Create a before insert business rule on 'sys_import_set' table having:

    Filter:
    Import set table is 'u_web_service_import'
    Action:
    Mode to Asynchronous

    4. Navigate to the Scheduled Script Execution 'Asynchronous Import Set Transformer'.
    URL: /nav_to.do?uri=sysauto_script.do?sys_id=d1bc736c0a0a0b2b002c3442345d6824

    5. Modify the script as follows:
    Change line #8

    From:
    igr.addQuery("state", "loaded");

    To:
    igr.addQuery("state", "loading");

    This is required, otherwise the import will never be transformed.

    6. Send data from REST API explorer or Postman to the Import set API for this import set table.
    7. Go to the scheduled script execution from step 4 and click on Execute Now.
    8. Open the recently created import and observe that there is only 1 import set run and 1 import set row. Only one of the two transform maps runs.

Workaround

When GlideImportSetTransformerWorker is initialized, the list of all transform map sys_ids need to be passed. For this, you need to update the functions sTransform() and getMap() with the script below. 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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();
}

 


Related Problem: PRB1330544

Seen In

There is no data to report.

Intended Fix Version

New York

Safe Harbor Statement

This "Intended Fix Version" information is meant to outline ServiceNow's general product direction and should not be relied upon in making a purchasing decision. The information provided here is for information purposes only and may not be incorporated into any contract. It is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. The development, release, and timing of any features or functionality described for our products remains at ServiceNow's sole discretion.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-04-15 08:46:49
Published:2019-04-04