- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2016 06:13 AM
I have user information which is being pulled in from our HR system. Everything is working fine, but they want to be able to update their information in ServiceNow independent of HR data. So, for instance, if you want to change your email address, phone or mobile number, you can do so, and the daily HR input will leave it alone. The proposed way of doing this is to have a script in the transform that says if employee.phone == "" then the source data is populated into the record. If there is anything in the field - leave it alone.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2016 06:35 AM
Hi Shembop,
Create a field map with employee.phone as the target field. On the field map form, tick the checkbox 'Use Source Script' and then enter a source script like this:
if (target.phone == ''){
answer = source.u_phone;
}
This assumes 'phone' is the name of the field in your source file.
Jamie.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2016 09:23 AM
Hi Shembop,
It sounds like the reference to the field in your source is not being recognised. Have you replaced 'u_phone' with the name of your field?
If you are loading from an excel spreadsheet , the name of the field will be 'u_' and then the name as you see it, but in lowercase letters and with spaces replaced by underscores. So for instance, if the column header is 'Phone Number', the field name will be 'u_phone_number', so you would replace the second line of the code with:
answer = source.u_phone_number;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2016 06:19 AM
Well, Well, it looks like you are correct, and my data dude changed the header on me. So it looks like this is now working! Thank you so much.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2016 07:01 AM
Hi Shembop,
You can try using a onStart or onBefore script in Transform Scripts as shown below
Transform Map Scripts - ServiceNow Wiki