Transform Script to update Location field in Transform Map
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2022 11:32 PM
Hi ,
I need to update the Target field based on the input from Source in Transform Map .
Below is the Source Fields and Traget field
Need to hard code through script for the following
For Example : if (San Newyork) update in target as Newyork
Please help on this writing transform script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 03:22 AM
Hi Ankur,
The script which you have given is updating undefined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 04:54 AM
are you giving correct display value for the location?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 10:50 AM
Hi Ankur
location is reference field. Not sure how to give the display value. Can you tell me ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 07:37 PM
Hi,
then the location name you are returning is the exact name?
where are you writing this script? is this in field map or onBefore transform script?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 07:19 AM
There are a few places you can do a script during a transform - I'm assuming you are using the script in the field mapping, if so then you want the following. Note that for referenced value field name, since location is a reference field, I selected Name so the transform will attempt to match what the script returns to the name field and set the target if match is found....