Transform map field map script

abhijeetpaw
Tera Contributor

Hello Experts,

I have written below field map scripting but it's not working can anyone please guide why it's not working.

answer = (function transformEntry(source) {

	if(source.u_model=="Apple Macbook Pro 16'' MVVJ2HB/A")
	{
var gr=new GlideRecord('cmdb_model');
gr.addEncodedQuery("display_nameSTARTSWITHApple Macbook Pro 16'' MVVJ2HB/A^short_descriptionLIKE32gb");
gr.query();
if(gr.next())
{
return gr.display_name; // return the value to be put into the target field
}

}
else{

	return source.u_model;
}

})(source);

thank you.

6 REPLIES 6

@abhijeetpaw So, you meant you are still getting the other model instead of the correct one?

abhijeetpaw
Tera Contributor

yes, one model is 16 GB and another one is 32 GB I  want to set 32 GB.