Transform map field map script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2024 04:49 AM - edited ‎01-12-2024 04:49 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2024 04:55 AM
Hi
In this
Apple Macbook Pro 16 MVVJ2HB/A
Do not use single quote ,wont consider string
Use properly double quote
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2024 05:37 AM
hello @gajananvwit ,
In my Excel, it's an Apple Macbook Pro 16'' MVVJ2HB/A. That is why I am using the same thing in my script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2024 05:25 AM - edited ‎01-12-2024 05:40 AM
Hi @Mark Wood ,
Please elaborate issue you are facing, you are seeing some errors? Or you didn't get the result you expected? Can you please put the screenshots of these two models here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2024 05:36 AM
Hello @DYCM I am not getting the expected result. There are two models with the same name so I am checking the short description for the product model if the short description contains 32GB then am set that model.