+ Start a Discussion
BradCBradC 

How to send a null xsd:date field through the soap api

Hey fellow developers!

 

Let me start by saying I am pretty new to all of this. Hopefully I am posting in the right board. I am new to the SOAP api, and development on the SFDC platform all together.

 

I am trying to code (with PHP) a script that clears out certain date fields in a custom SFDC object. The problem is, I don't know what I should be passing to this field to clear it out. I have tried passing "null", "0", "false", "" (blank), and I keep getting the error:

 

Fatal error: Uncaught SoapFault exception: [soapenv:Client] '' is not a valid value for the type xsd:date in /path/to/soapclient/SforceBaseClient.php:509

 I can't imagine there isn't a way to clear out this field via the API. The field is not marked as required in SFDC. Does anyone have any ideas for me to try?

 

Thanks in advance!!

 

Brad 

Best Answer chosen by BradC
SuperfellSuperfell

You need to use the fieldsToNull property, passing in the name of your date field.

All Answers

SuperfellSuperfell

You need to use the fieldsToNull property, passing in the name of your date field.

This was selected as the best answer
BradCBradC

Thanks so much Simon! That worked like a charm. I had forgotten all about the fieldsToNull property. You rock! =)

 

Brad

Adhar JainAdhar Jain

We are getting an error while we do not send anything to the date field saying invalid date value to XSD:Date. Could you please tell me more about this fieldsToNull property on how to set it in C#. We are using Partner API  to update policy customer object that has date value which may not have a value. Similarly we have to pass 0 to integer values for it to pass. Would really appreciate if can get something on this.