Update target with a null value if the source is null from transform map
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2023 02:55 PM
Update target with a null value if the source is null from transform map with out using 'Copy Empty Fields'
I have used below script but it is not working, could I get some help here please
answer = (function transformEntry(source,target) {
//var gdt = new GlideDateTime(source.u_last_day);
//return gdt.getValue();
//if (source.u_last_day == '') {
if (source.u_last_day.nil()){
target.u_last_day == '';
}
})(source);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2023 05:40 AM
The field I'm trying is not mandatory, I see there's is a data policy error from Import logs. It says User ID should be populated, but thats always populated and mandatory not sure about the error.
I tried the script from below post but that isn't working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2023 08:08 PM
@Community Alums Write below code
answer = (function transformEntry(source) {
if (!source.u_last_day) {
return "";
}
})(source);
And set the target field as Last day in field marked in image below
Please mark as correct answer if this solves your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2023 05:38 AM
Sorry, this didn't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2023 05:45 AM
@Community Alums Hello,
Can you try below code:
answer = (function transformEntry(source,target) {
if (source.u_last_day.nil()){
var null_date = new Date(0);
target.u_last_day = null_date
//or you can check this also target.setValue('u_last_day', null_date);
}
})(source);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 09:23 AM
Thanks for the response.
It did not work, I need to copy values when there is some data in it and copy empty value when it is blank. I believe this script works only for null values.
