+ Start a Discussion
mobile1.390759152613193E12mobile1.390759152613193E12 

New or Update record through Rest API fails if you pass a date field empty.

Hi, I am receiving the following message when trying to create an Event fields throught the mobilesdk REST API:

{"errorCode":"JSON_PARSER_ERROR","message":"Cannot deserialize instance of date from VALUE_STRING value  at [line:1, column:32]"}]

It is using a patch call with the following payload:

Date__c: ""
Date_time__c: ""
EndDateTime: "2014-03-19T13:04:34.00Z"
OwnerId: "005E0000000eHwWIAU"
StartDateTime: "2014-03-19T13:04:30.00Z"
Subject: ""
WhatId: ""
WhoId: ""

Is this normal? How can I save a record with a date or datetime field with empty value?

Thanks for replying

Maurizio
mobile1.390759152613193E12mobile1.390759152613193E12
Any help you can give me on this?

It really looks a Bug in the API. How can I update to null or "" value a date or datetime field using the REST API?
For example I can't delete the Birthdate of a contact through a Mobile Application?

Thanks a lot for the support

Maurizio. 
Siddhesh G. KabeSiddhesh G. Kabe
check this link https://developer.salesforce.com/forums/ForumsMain?id=906F00000009BsqIAE
mobile1.390759152613193E12mobile1.390759152613193E12
Thanks for the answer, but I don t have issues in saving Dates, since I do format them in ISO 8601. The problem is when the date Field is empty that I get the error.

Thanks for the help
Dev AngelDev Angel
That's not an empty date field, it's a zero length string. If you want to clear the date field use:
{
"Date__c":null
}
mobile1.390759152613193E12mobile1.390759152613193E12
Thanks a lot Dev Angel, it works well now.