1

I have a CSV file with a Date of Birth field in the format of "MDDYY" or "MMDDYY".

I'm importing with Data Loader to a Text field, which triggers a Flow to fire upon record creation, which is supposed to convert the value to a Date field (the new YYYY-DD-MM format), but it keeps returning null instead (confirmed via debugging).

I've been struggling for days, looking up similar answers and consulting coworkers. Nobody can figure out why. The rest of the flow fires perfectly fine.

IF(
LEN({!$Record.Birthdate__c}) = 5,
DATEVALUE("20" & RIGHT({!$Record.Birthdate__c}, 2) & "-" & MID({!$Record.Birthdate__c}, 2, 2) & "-" & "0" &  LEFT({!$Record.Birthdate__c}, 1)), 
DATEVALUE("20" & RIGHT({!$Record.Birthdate__c}, 2) & "-" & MID({!$Record.Birthdate__c}, 3, 2) & "-" & LEFT({!$Record.Birthdate__c}, 2))
)

I know the LEN() function is working properly, because it's pulling the right number in debug and when I tested pushing the value of it to a different text field. So it's something with the rest of the script.

Thank you for any help you can provide!

2
  • 3
    DATEVALUE expects input to be yyyy-mm-dd; Help doc
    – cropredy
    Commented Jul 19, 2023 at 21:08
  • I feel so dumb. Thank you @cropredy, that was it!
    – Snowlian
    Commented Jul 19, 2023 at 21:31

1 Answer 1

1

Answer provided by cropredy (thank you!)

DATEVALUE expects input to be yyyy-mm-dd

I was doing "yyyy-dd-mm" and just needed to flip the month and day positioning. It was returning blank on the records I was testing with because the day value was larger than a possible value for a month (e.g. "25" isn't a possible month).

Thanks again!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .