How to change import set row mode to asynchronous ?

kharesr
Kilo Explorer

Hi All,

When record is inserted in staging table through web service the import set mode is set to synchronous and transform map runs and record is created in the target table. Is it possible to set the mode to asynchronous , how to do this? 

Regards,

Snehal K

1 REPLY 1

Raj68
Mega Guru

Hi!

Hope this may help you in your task.

The following is a list of steps to import data from an Outbound REST call in combination with a MID Server using a Scheduled Job and hold it with in an   Import Set table using Asynchronous Import Set and Transform Map. Then schedule a job to perform the transform.

 Create a table that extends Import Set Row

    1. Give it a name
    2. Create a new application menu or Place module under Existing application menu or none
    3. Uncheck the auto create user role if not desired
    4. Create necessary columns
  1. Create Transform Map
    1. Enter name of above table with .list appended in the text filter box
      1. <table_name>.list
    2. Click on Transform Maps
    3. Click New
    4. Give it a name
    5. Assign the target table
  2. Create an import set
    1. Enter sys_import_set.do in text filter box
    2. Set mode to Asynchronous
    3. Keep State at Loading
    4. Set table to import set table created in step one
    5. Give description if needed
  3. Create Outbound REST call
    1. When creating the call method be sure to populate the MID Server field with desired MID Server
  4. Create a Scheduled Job (not a Scheduled Import) to populate the import set
    1. Click New
    2. Choose to run a script
    3. Set the desired times when to execute script
    4. Grab the scripted code from the REST call by clicking the Preview Script Usage
    5. Create a script that will use the REST call script usage to populate the table created in step one. You can also do any manipulation in here before populating or use the script sections in the transform map.
      1. Example:
        try {
          var r = new sn_ws.RESTMessageV2('name_of_your_outbound_rest_message', 'get');
          r.setStringParameter('a_parameter', 'parameter_value');
          var response = r.execute();
          var responseBody = response.getBody();
          var httpStatus = response.getStatusCode();
        }
        catch(ex) {
          var message = ex.getMessage();
        }
        var results = responseBody.split(','); //This depends on what's in your response
        var restGR = new GlideRecord('u_table_from_step_one');//Important
        restGR.initialize();
        restGR.u_assigned_to = result[0]; //this would depend on your response
        restGR.u_assignment_group = result[1]; //this would depend on your response
        restGR.u_short_description = result[2]; //this would depend on your response
        restGR.u_description = result[3]; //this would depend on your response
        restGR.sys_import_set = 'sys_id of the import set created in step 3'; //Important
        restGR.insert();
  5. Modify the Scheduled Job named "Asynchronous Import Set Transformer" to meet your requirements to run all Asynchronous import sets or just the one specific Rest Call import set if you haven't done your specific modifications in step 5 or in the Transform Map

 

Thanks

Raj Patel

(DXSherpa)

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact