Run transform map from REST API

Kaniel Battles
Tera Contributor

I created a module where the users attaches a spreadsheet, submits the record and it kicks off a transformation.  I am using the business rule below.  This has worked great until we encrypted a field in the table.  ServiceNow support said, "I think you can get this to work if you use a web service call with a transform map. This is because the transform map will use the same user session which make the Web Service Call."  I have been looking at the REST API Explorer and cannot figure out how connect the dots to execute the transform map on an excel spreadsheet.  Any advice is greatly appreciated.

//  Note that the data source sys_id below is the one to which the attachment will be affixed.
var sysId=current.sys_id;	
GlideSysAttachment.copy('my_table', sysId, 'sys_data_source', '<sys_id>');	

//  Trigger start of scheduled import:
var rec = new GlideRecord('scheduled_import_set');
rec.get('name', 'my_import_set');
gs.executeNow(rec);		
5 REPLIES 5

anurampalli
Tera Guru

I am aware, theoretically, that you can move the records into an importset table and then programmatically trigger a transform map.

 

However, not having done a PoC, I cannot say how this can be done if batch processing is required. If I manage it tonight before my comment gets approved and published, I might have an update for you.