You need to sign in to do that
Don't have an account?
mh1974
Cannot set date field to null through Enterprise WSDL
I'm writing a piece of C# code to reset a date field after a set time period has elapsed, here's a demo of the code:
AccountObject.MyDate__c = null;
AccountObject.MyDate__cSpecified = true;
However, when I run the update, nothing happens. If I assign a date, I get a result. I can manually update the record and remove the date, so, why can't I do this through code?
All Answers
By Jove I think he's got it! Here's what I did:
AccountObject.MyDate__c = null;
AccountObject.MyDate__cSpecified = true;
AccountObject.fieldsToNull = new string[1] { "MyDate__c" };
You still need to set field to null otherwise you get an error along the lines of,
"A duplicate value was specified for field 'MyDate__c' in object 'Account', duplicate value 'Thu Oct 01 00:00:00 GMT 2009' prior value '' (prior value could have been set to '' with 'fieldsToNull')"