Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2024 09:46 AM
please correct this code, i am getting empty watchlist
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var watchList = [];
var activeEmail = source.u_data_identify_active_email_;
var nonEmail = source.u_data_identif_ive_non_email_;
var email = source.u_data_identify_email_;
gs.info("@@@ "+activeEmail+" "+nonEmail+" "+email);
if(activeEmail == true){
watchList.push("2fe56c168796e1d01436877d0ebb352d");//Active Email- 2fe56c168796e1d01436877d0ebb352d
}
else if(nonEmail == true){
watchList.push("509032d647131518ec2ae757436d432a");//Non Email- 509032d647131518ec2ae757436d432a
}
else if(email == true){
watchList.push("2fe56c168796e1d01436877d0ebb352d");//Email- 5fcfe2da47131518ec2ae757436d433f
}
target.u_identify_data_media = watchList;
gs.info("@@@1 "+watchList);
})(source, map, log, target);
Solved! Go to Solution.
1 ACCEPTED SOLUTION

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2024 09:50 AM
You should stringify the array like watchList.toString() to set a list field. I would also suggest not hard coding with sysids.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var watchList = [];
var activeEmail = source.u_data_identify_active_email_;
var nonEmail = source.u_data_identif_ive_non_email_;
var email = source.u_data_identify_email_;
gs.info("@@@ "+activeEmail+" "+nonEmail+" "+email);
if(activeEmail == true){
watchList.push("2fe56c168796e1d01436877d0ebb352d");//Active Email- 2fe56c168796e1d01436877d0ebb352d
}
else if(nonEmail == true){
watchList.push("509032d647131518ec2ae757436d432a");//Non Email- 509032d647131518ec2ae757436d432a
}
else if(email == true){
watchList.push("2fe56c168796e1d01436877d0ebb352d");//Email- 5fcfe2da47131518ec2ae757436d433f
}
target.u_identify_data_media = watchList.toString();
gs.info("@@@1 "+watchList);
})(source, map, log, target);
You
Please mark this response as correct or helpful if it assisted you with your question.
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2024 09:50 AM
You should stringify the array like watchList.toString() to set a list field. I would also suggest not hard coding with sysids.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var watchList = [];
var activeEmail = source.u_data_identify_active_email_;
var nonEmail = source.u_data_identif_ive_non_email_;
var email = source.u_data_identify_email_;
gs.info("@@@ "+activeEmail+" "+nonEmail+" "+email);
if(activeEmail == true){
watchList.push("2fe56c168796e1d01436877d0ebb352d");//Active Email- 2fe56c168796e1d01436877d0ebb352d
}
else if(nonEmail == true){
watchList.push("509032d647131518ec2ae757436d432a");//Non Email- 509032d647131518ec2ae757436d432a
}
else if(email == true){
watchList.push("2fe56c168796e1d01436877d0ebb352d");//Email- 5fcfe2da47131518ec2ae757436d433f
}
target.u_identify_data_media = watchList.toString();
gs.info("@@@1 "+watchList);
})(source, map, log, target);
You
Please mark this response as correct or helpful if it assisted you with your question.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2024 10:17 AM
got solved by just giving
watchList.toString(","); at end. thanks.