- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2014 01:09 PM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2015 07:28 AM
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;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2015 07:28 AM
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;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2015 08:01 AM
Thanks a lot, Bhupinder! The GlideImportSetTransformer is the object that I was looking for.
I wonder why these useful objects are so poorly documented in the wiki of ServiceNow. I can only see it listed here. No member methods nor properties explanation...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2015 08:03 AM
Agreed. Package calls are not properly documented don't know why
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2015 07:59 AM
Can you please mark the answer correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2015 09:49 AM
Hi Bhupinder. I clicked on "Like" for your answer and I think that is all that I can do. Since you posted the original question, you have to mark the answer that is correct. I do not think I have the permission to do it (at least, I do not see the option).