Transform map script is not working on target field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2024 01:10 AM
Hi All,
I have written a script on transform map field mapping as below to get the displayname in return to update the Model ID field in CMDB
here I'm trying to update the display value in target field but it's returning blank
my script:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2024 01:29 AM
Hi @Vamshi_ch123 ,
Have you tried logging source.u_model and source.u_make to see correct values from source??
and your choice action is "Create" , your logic says if record not found it return empty to create.
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2024 01:48 AM
Hi @Hemanth M1 ,
so can I keep the choice as ignore for blank values/ or record not found?
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2024 01:53 AM
@Vamshi_ch123 Could you please update your script as follows.
answer = (function transformEntry(source) {
var gr = new GlideRecord("cmdb_model");
gr.addQuery('name', source.u_model);
gr.addQuery('manufacturer.name', source.u_make);
gr.query();
var returnVal = '';
if(gr.next()){
returnVal = gr.display_name.toString();
}
return returnVal;
})(source);