- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2021 07:55 AM
Hi,
I have to update more than 100,000 records in sys_user table with location, phone number and email from an excel sheet. Some of the records have one or more of the values missing and some have all the values. I want to know what is the best way to check if any of the fields are empty and update the field with the value from excel sheet. I also want to skip any records that have all the values. I do not want to insert any new records. Is it better to use transform script? If so, Do I use onBefore? How do I check if any of the fields values are missing and only update the missing values? Appreciate it.
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2021 08:06 AM
Hi,
you can only determine if the target field is empty or not once you determine if record is to be created/updated based on Coalesce field
You can use onBefore transform script for this
Example for 1 field. enhance for other fields as well
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if(target.last_name == ''){
target.last_name = source.u_last_name;
}
})(source, map, log, target);
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
11-11-2021 10:32 PM
Hi,
Should work fine.
Did you check it went to if statement or not?
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
11-12-2021 10:43 AM
I'm not familiar with the check. Please guide. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 02:03 AM
Hi,
When i try to gs.log(target.correlation_id) in field map it return it empty even if it us not? Can field map even see target fields?