Transform Map - specifying default selection and execution order.

damianfell
Tera Guru

When running transforms on an Import Set, is it possible to specify which transform maps are selected by default and in what order?

I have a situation where I have two transform maps, where one must always run before the other (to write new records to 'cmdb_ci', before creating their relationships in 'cmdb_rel_ci').

When opening the transform form, only one is already in the "selected maps" list, and annoyingly it's always the one that should run second, so I need to write a manual step into the operating procedure to not only add the second transform, but to also change the order.

I can't find anywhere to define which map (or ideally both) is pre-selected in that box, nor any way to define in advance the order that transform maps run in.

I've tried changing the "order" column on the transform map table, but that makes no difference.

 

3 REPLIES 3

Gurpreet07
Mega Sage

if scheduled import is configured for the associated data source then the transform maps will be executed as per order defined on thansform map. You could test this using execute now button over scheduled import.

premer
Giga Expert

Hello,

in case you are still having this issue (or to maybe help others with the same issue), the selected transforms on that page are defined in the run_import UI Page. In the HTML field of the UI page, if you scroll down to around line 80, there will be the loadMaps function. We only wanted to add the lowest order transform map in the right bucket by default (and for some reason it also took the wrong one by default), so in the gliderecord query I added the orderBy line:

var mgr = new GlideRecord('sys_transform_map');
        mgr.addQuery('active', 'true');
        if (source_table)
            mgr.addQuery('source_table', source_table);
		mgr.orderBy('order');

        mgr.query();

Dale Hynes
Kilo Sage

I created a Business Rule to append the map 'order' onto the name, you can check the names and drag across/up/down as required.

Table: sys_transform_map.

Advanced: True.

When: Before, 1000, Insert, Update

  • Filter Conditions: 'Name' Changes OR 'Order' Changes
(function executeRule(current, previous /*null when async*/ ) {

    var justName = current.name.toString();
	var matchName = justName.match(/^([^(]+)/);
	matchName = matchName[1].trim();
	current.name = matchName + ' (' + current.order.toString() + ')';
	
})(current, previous);