Help needed on transform map
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 01:39 AM
Hello All,
I have just started working on transform map. I need help on below requirement how to achieve.
I have field on source table u_company. In target table there is field company. I need to map through script.
Incoming values have to be matched with Values in Table Companies(core_company).
Incoming values will be Microsoft and Lenovo. These two companies exist in core_Company table.
How to map through script can anyone please help me.
Regards,
Mansi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 01:49 AM
Hi @Mansi roy
answer = (function transformEntry(source) {
var gr = new GlideRecord('core_company');
if (gr.get('name', source.u_company /*put your source field name here*/ )) {
return gr.getValue('sys_id');
}
return "";
})(source);
in the field you can use the shared script
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 01:54 AM
Since you said you will get name of company in source table
simply in field map set "Referenced value field name" field as name and no scripting required
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2025 12:59 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader