+ Start a Discussion
SFDC consultant integratiSFDC consultant integrati 

I am getting this error if I insert date field with empty or null - " '' is not a valid value for the type xsd:date"

I am getting this error if I insert date field with empty or null - " '' is not a valid value for the type xsd:date"
Hi All,

I am trying to insert data with Postman Rest client.
while inserting data if date field is empty or null then it throws this error.
If the date field have some value in it then it successfully inserted.

Error Message - '' is not a valid value for the type xsd:date

Please help me to insert date field with empty or blank in xml form

Any help is appriciated.

Thanks,
Rakesh Jampal
 
Nayana KNayana K
These links may help :
http://stackoverflow.com/questions/774192/what-is-the-correct-way-to-represent-null-xml-elements
http://stackoverflow.com/questions/7342038/solr-indexing-date-field-with-empty-no-value
Amit VaidyaAmit Vaidya
Hi Rakeshkumar,

Please try updating your code as follows it should work:
 
<xs:element name="EffectiveDt" nillable="true" minOccurs="0">
  <xs:simpleType>
   <xs:list itemType="xs:date"/>
  </xs:simpleType>
</xs:element>
Thanks,
Amit
 
SFDC consultant integratiSFDC consultant integrati
I am sending below request thr postman

<Contact>
  <AccountId>0014B00000930cZQAQ</AccountId> 
  <FirstName>Sophie</FirstName> 
  <LastName>Mellon</LastName> 
  <MailingStreet>48 Toh Guan Road East</MailingStreet> 
  <MailingCity /> 
  <MailingState /> 
  <MailingPostalCode>608586</MailingPostalCode> 
  <MailingCountry>Singapore</MailingCountry> 
  <OtherStreet>TBA plc</OtherStreet> 
  <OtherCity /> 
  <OtherState /> 
  <OtherPostalCode>NW1 2ND</OtherPostalCode> 
  <OtherCountry>Singapore</OtherCountry> 
  <Phone>0044 207 554 9900</Phone> 
  <Fax /> 
  <Email>pg@tbaplc.co.uk</Email> 
  <Title /> 
  <Contact_ID__c>Sophie Mellon</Contact_ID__c> 
  <Customer_Code__c>C-SGDYB-2868</Customer_Code__c> 
  <Gender__c /> 
  <MobilePhone>0044 7805 938 325</MobilePhone> 
  <Description /> 
  <Birthdate/>
  <Department /> 
  </Contact>

got error

{
    "message": "'' is not a valid value for the type xsd:date",
    "errorCode": "XML_PARSER_ERROR"
  }


give me solution on it