Can I run a transform map from within a workflow?

kvvijay1979
Kilo Contributor

I am exploring the possibility of automating an import, load and run transform map - all 3 entirely from within scripts defined inside a workflow. The idea here being, we present the   data import functionality as a catalog item that can be requested from a catalog. The request will include an excel file with the data to be imported. The workflow   defined on the resulting request will include scripts that will populate the base table in this sequence:

1. Create a data source with the attachment in the RITM.

2. Create an import set and identify the above data source in this import set.

3. Load the data from the data source into the import set.

4. Run a transform on this import set.

I am guessing steps 1 & 2 are doable. I am not sure if Steps 3 and 4 are even doable because I am not sure how to scriptify the 'Load Data' and 'Run Transform' actions. Any thoughts?

5 REPLIES 5

varaddd
Tera Contributor

Hello I  also somewhat faced the same situation .
>Create a scheduled import set table and set it as inactive .
>Create your data source and set the transform map 
>In workflow use the run script and for that data source use the gs.executeNow() function
>Run the following script in workflow 

var exportGr = new GlideRecord("scheduled_import_set");
exportGr.addQuery("sys_id", "xxxx"); // sys_id of the record in the scheduled import table
exportGr.query();
if (exportGr.next()) {
gs.executeNow(exportGr); // this is for scoped app
 //SncTriggerSynchronizer.executeNow(schImp_GR); // this is for non scoped app
 }