I have the following script:
%dw 2.0
input records application/csv
output application/apex
---
records map(record) -> {
IVP_First_Name__c: record.'First Name*',
IVP_Last_Name__c: record.'Last Name*',
IVP_Middle_Name__c: record.'Middle Name',
IVP_Date_of_Birth__c: record.'DOB*' as Date{format : "M/d/yyyy"},
...
This works fine except when there is no date entered on the CSV. It just throws an obscure error message and I cannot get into the results to make any changes. The response just shows commas for missing data like JOE,,,,TRUE
Is there a way I can define a default value or 'null' for the date in my script above?
Thanks.
DataWeave has some options for setting default, not sure they all work in Apex, but worth a try https://docs.mulesoft.com/dataweave/latest/dataweave-cookbook-defaults