How to update data using transform map

Anna_Servicenow
Tera Guru

I have a requirement where I need to update the network type of different CI classes.

I have a transform map running on cmdb_ci table but I dont find network type in cmdb_ci table but I see it in cmdb_ci_netgear.

 

How to I use the transform map and update the same?

13 REPLIES 13

A right, my mistake. You don't need to use a source script, but a onBefore Transform script.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

I am sorry, It is still not updating !!

 

I see the target table is still cmdb table and no update happening in netgear table

The target table should not change, because you are using the .ref_cmdb_ci_netgear. to dotwalk to the right table.
It might be that this is not possible this way in a transform map, and only in Business Rule for example.

In that case I would suggest to use @Vishal Birajdar's solution.
 


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Ankur Bawiskar
Tera Patron
Tera Patron

@Anna_Servicenow 

So you can use onBefore transform script and determine the class and then set the type

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

	// Add your code here
	if(target.sys_class_name == 'cmdb_ci_netgear')
		target.u_network_type = ''; // give here the correct choice valuef or the target choice field

})(source, map, log, target);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Tried this by removing coleace, It is creating record in ci table, but not updating