Why is the date field from my transform map not coming over?

e_wilber
Tera Guru

This is what the data looks like on the transform table for my date field:

e_wilber_0-1719859996082.png

 

The transform is set up as this below. I'm definitely massaging the date so it matches my date format but on the record I'm creating it's not setting the date field at all. Why wouldn't this date be set on a date field?

e_wilber_1-1719860050397.png

 

 

1 REPLY 1

briannice
Kilo Sage

Hi @e_wilber 

 

I see in your return statement that you are returning 'month-month-day'. You should return the year of the date first, which is the third element (so index 2).

 

return dateSplit[2] + "-11-" + dateSplit[0];

 

You can aslo try to use the GlideDate class as described in the documentation if returning a string is not working.

 

answer = (function transformEntry(source) {
    var monthMap = {
        "Jan": "01",
        "Feb": "02",
        "Mar": "03",
        "Apr": "04",
        "May": "05",
        "Jun": "06",
        "Jul": "07",
        "Aug": "08",
        "Sep": "09",
        "Oct": "10",
        "Nov": "11",
        "Dec": "12",
    };

    var inputDate = source.getValue("u_acquisition_date");
    var day = inputDate.split("-")[0];
    var month = inputDate.split("-")[1];
    var year = inputDate.split("-")[2];

    var date = new GlideDate();
    date.setValue(year + "-" + monthMap[month] + "-" + day);
    return date;
})(source);

 

Let me know if this works.

 

Kind regards,

Brian