Help with a field map script

AEterni
Mega Guru

Hello All,

 

I am experiencing an issue with a transformation map I created. My issue is that one of the reference fields mapped in the transformation map is not picked up properly.

 

I logged a ticket with ServiceNow and they confirm that the transformation map is configured properly. They suggested using a script in the field mapping to make sure the proper field is picked up.

 

I told them that I don't have any code experience, but they can't provide any suggestions when it comes to scripting because it means "product customization" and, as a consequence, "not supported.

 

This is how the field map looks like.

AEterni_0-1669375308875.png

How do I achieve the same result with a scrip? Is the following one correct?

answer = (function transformEntry(source) {

	// Add your code here
	return source.u_model;
	
})(source);

 

Thank you.

7 REPLIES 7

Thank you.

 

It is not a coalesce issue. I already tried it.

Edgar10
Tera Guru

Hi ,

 

Yes this should do the trick if you don't have any manipulations of data.

 

answer = (function transformEntry(source) {

	// Add your code here
	return source.u_model;
	
})(source);

abroeglin
Tera Contributor

Isn't model a reference field? I had almost the same case, and I used Referenced value field name (the name of the field on the referenced table) and it worked. It was a similar case, a reference to the Model table, I just wrote "name".