2

I am working with a Google Apps Script to upload data into Salesforce. Everything works except I am running into this error when a date is not present in a date field, which happens only occasionally throughout my sheet. I am wondering what my options are to prevent this from happening?

My payload looks like this, where the xxx is censored information:

{"Name":"xxx","BillingStreet":"xxx","BillingCity":"xxx","BillingState":"xxx","BillingPostalCode":"xxx","Billing_Contact__c":"","Phone":"xxx","Billing_Email__c":"","Active_customer__c":"Y","Last_Invoice_Date__c":"","Account_Creation_Date__c":"xxx"}

The full error I am receiving is this:

[{"message":"Cannot deserialize instance of date from VALUE_STRING value  or request may be missing a required field at [line:1, column:268]","errorCode":"JSON_PARSER_ERROR"}]

Last_Invoice_Date__c is the only field that may or may not have a date, and the error seems to only happen when the date is not present. How can I patch this with an empty field?

To add to this, it only happens on the date fields.

1 Answer 1

2

Found my answer. I passed the field as a null instead of a 0 length string and that corrected it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.