Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Data Source with multiple transform maps

Jazz4
Tera Contributor

I have a data source with multiple transform maps. I am trying to execute the two maps via the GlideImportSetTransformerWorker API call. The first map executes and then resets the import set to a "Processed" State inspite of an OnComplete trigger which explicitly resets the state to "Loaded" with the data in "Pending" State. The second map never executes because I see data in a "Pending" state in the importset table. All I want is the functionality behind the Transform in the foreground where you get to pick both the maps one time and be done.

Is there a way to execute all the maps and enforce the order in which they are set through a script? The GlideImportSetTransformerWorker API is being called from global scope which is another issue I have been trying to avoid and I see no other solution on the horizon. Folks have reported it so many times but not a single workable alternate solution has been proposed. 

 

Thanks

2 REPLIES 2

Rafał Rataj
Tera Contributor

any luck on this issue? 🙂 
I am loading the data to import table from flow and have the same problem that I can not add the second transform map ( I am creating assets and need also create CI;s but do not want to mess up the BR orders) 

Rafał Rataj
Tera Contributor

 

GlideImportSetTransformer

var importSet = new GlideRecord('sys_import_set');
importSet.short_description = 'Import set from scripted rest api';
importSet.table_name = importSetTableName;
var importSetID = importSet.insert();
var transformer = new GlideImportSetTransformer();
transformer.transformAllMaps(importSet);
if(transformer.isError()) {
	gs.error('Error executing the transform');
}

 

 transformAllMaps does the trick