- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 06:49 AM
Hello, I was trying to understand what I might did wrong here.
My goal here is to change only value from "###" to "aaa", the rest of the values should remain untouched.
Unfortunately with this easy function script I am able to change the value "###" to "aaa", but the rest of the fields changed its value to "undefined". Can you please let me know what I am missing here? Thanks in advance.
Here is the simple transform map script function:
answer = (function transformEntry(source) {
if (source.u_business_phone == '###' ){ return 'aaa';}
})(source);
Here is the screen from instance before the transform, then the excel sheet with new data and then after the transform is complete.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 07:40 AM
Hi @Miloslav1,
Based on the script you've provided, you're running this as a script at field level. (Business phone field)
I've made a small tweak to your script to use:
answer = (function transformEntry(source) {
if (source.u_business_phone == '###') {
return 'aaa';
} else {
return source.u_business_phone;
}
})(source);
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 07:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 07:47 AM
Can you please try below logic in your script?
(function runTransformScript(source, map, log, target) {
if (source.u_business_phone == "###") {
target.u_business_phone = "aaa";
} else {
target.u_business_phone = source.u_business_phone;
}
})(source, map, log, target);
If my response helped you, please mark it as correct or helpful.
If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni