+ Start a Discussion

Date Time value not passed from C# to SF

I am using web service to create a custom object called Registrant. The c# code send all the fields for this object.

I dont have problem in passing all other values except DateTime value during creation of the record.

The same value is passed during updating a record.


Initally the datetime value was not passed at all. So I followed the solution given in this form.


Now the value is passed during update & only not during Insert.


FYI: This is the code I am using in both the places - insert & update methods.

DateTime ppAck = DateTime.valueOf(mRec.privacyDate);

if(ppAck==null) cReg.Privacy_Policy_Date__c = null;

else cReg.Privacy_Policy_Date__c = ppAck;


mRec.privacyDate gives date time value when passed in update method & always gives null value when passed in insert method.

The c# code is also exactly same in both the places. The Date time value is passed from SF to C# too.


Any Ideas?

Thanks in advance.


Thanks for the reply!

But DateTime is passed in 1 method (edit/set method) & not in another (insert/add method)!

And the DateTime value is mandatory field. So it never has null values when sent from C# code.

I want to avoid converting it into String before sending & convert string back to datetime after receiving in SF.


You need to set the specifed flags, almost certainly that is your problem, otherwise please post a complete code sample that demonstrates your issue.