- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 08:28 PM
Hi,
I have a requirement involving a catalog item in the portal, which is already implemented for bulk upload. When we select the CI class variable from the portal, the respective transform map should run. However, currently, if we have 12 rows in the template, every transform map runs 12 times, resulting in a total of 17 TMs * 12 (number of rows in the template). This means if we have 1000 records, each TM runs 1000 times. It is not necessary for all transform maps to run; only the one related to the selected class should run when we import data from the bulk import catalog.
Can anyone suggest me to make this possible please.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 09:08 AM
Thanks for the info.
I'd replace your 'Trigger Transformation' with the following segment
var importSetRun = new GlideImportSetRun(importSetRecSysID);
var transformer = new GlideImportSetTransformer();
transformer.setImportSetRun(importSetRun);
transformer.setMapID('sys_id_of_map_here');
transformer.transformAllMaps(importSet);
The setMapID is where you want to define the sys_id of the ma based on your Type of CI choice list. You could do this with an object
//Access your type of CI variable, and get it's value
var choiceValue = grRitm.variables.type_of_ci;
//left 'key' is the choice options for the variable,
//right 'value' is your map IDs
var choiceTransformMapLookup = {
'ssbd' : 'f72885290a0a0b4d01957352e8a29e31',
'kiosk' : 'sys_id',
'biopod' : 'another sys id'
}
var importSetRun = new GlideImportSetRun(importSetRecSysID);
var transformer = new GlideImportSetTransformer();
transformer.setImportSetRun(importSetRun);
transformer.setMapID(choiceTransformMapLookup[choice_value]);
transformer.transformAllMaps(importSet);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2025 10:02 AM
Hi,
Can you share details of this catalog item? Are you triggering a flow/workflow to parse the attachment and import data into an import set? Can you share your code for us to review?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 08:34 PM
@Kieran Anson
Thanks for your response!!
We are triggering via flow designer with to run the data source and the respective TM's
here is the script from flow designer
If you see the piece of below code
==============================
var grImpSet = new GlideRecord('sys_import_set');
if (grImpSet.get(importSetRecSysID)) {
var transformer = new GlideImportSetTransformer();
transformer.transformAllMaps(grImpSet);
They have used the object called “transformAllMaps.” Instead of this, I need to trigger the TM based on the selection of the CI type from the portal. The respective TM should trigger based on the selected CI.
Could you please suggest how I can proceed to trigger the TM based on the selected CI from the portal?
FYI: The “on before” script is already written based on the CI selected in the template.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 09:08 AM
Thanks for the info.
I'd replace your 'Trigger Transformation' with the following segment
var importSetRun = new GlideImportSetRun(importSetRecSysID);
var transformer = new GlideImportSetTransformer();
transformer.setImportSetRun(importSetRun);
transformer.setMapID('sys_id_of_map_here');
transformer.transformAllMaps(importSet);
The setMapID is where you want to define the sys_id of the ma based on your Type of CI choice list. You could do this with an object
//Access your type of CI variable, and get it's value
var choiceValue = grRitm.variables.type_of_ci;
//left 'key' is the choice options for the variable,
//right 'value' is your map IDs
var choiceTransformMapLookup = {
'ssbd' : 'f72885290a0a0b4d01957352e8a29e31',
'kiosk' : 'sys_id',
'biopod' : 'another sys id'
}
var importSetRun = new GlideImportSetRun(importSetRecSysID);
var transformer = new GlideImportSetTransformer();
transformer.setImportSetRun(importSetRun);
transformer.setMapID(choiceTransformMapLookup[choice_value]);
transformer.transformAllMaps(importSet);