REST Import set mode

Bhupinder1
Giga Expert

I'm working on integration and successfully loaded data in import set table via REST API call for third party product. Since SOAP/REST transforms data in synchronous mode by default so I wanted to change the mode of the import set transform. I'm using schedule script to call the REST API method and loading data in ServiceNow import tables.

 

Regards

Bhupinder

1 ACCEPTED SOLUTION

Correct missed a function. But here is full piece-


var CreateAsynchImportSet = Class.create();


CreateAsynchImportSet.prototype = {



  createImportSet: function(tableName,description) {


  var isgr = new GlideRecord("sys_import_set");


  isgr.initialize();


  isgr.mode = "asynchronous";


  isgr.state = "loading";


  isgr.table_name = tableName;


  isgr.short_description = description;


  var is_id = isgr.insert();


  return isgr;


  },



  setStateTransform: function(setId) {


  //Mark the import set as Loaded


  setId.state = "loaded";


  setId.update();


  // transform the import set


  var t = new GlideImportSetTransformer();


  t.transformAllMaps(setId);


  return setId.state;


  }


}


View solution in original post

10 REPLIES 10

So I have been playing with GllideImportSetTransformer and it works perfectly... as long as you are in the Global scope. It does not work for scoped applications. I am starting to lose faith...