+ Start a Discussion

Problem with setting a date field :-(

Hi guys,

I'm having problem with setting a date field ...

on salesforce .com, I creatated a case field "Date Rquest Needed" which is Date type.

I'm programming under C# programming language.

in the Case object named _case:
_case.DateRequestNeeded__c wich is a System.DateTime object.

I obtain the date from a calendar (System.Web.UI.WebControls.Calendar) called msrCalendar:
_case.DateRequestNeeded__c = msrCalendar.selectedDate;

I check if the _case.DateRequestNeeded__c is set by diplaying it, and it is set corrctly!

I set other _case's fields also. Then I post the _case object like this:
sObject[] so= new sObject[1];
so[0] = _case;

The posting works well, the case is created, the fields are set EXCEPT THE Date Request Needed that stays BLANK

I don't get it!

Environement :
Sforce 4.0
Visual Studio .NET 2003
programming with ASP.NET and C#



If it is a datetime field try putting it in the format:


This would be today's date at 9:30 GMT



can you give me the exact instruction to do that? in C#

or the method at least that allows me to fix the the format



remember to set the DateRequestNeeded__cSpecified flag to true.

Hi Basil,

Looks like you are using the enterprise wsdl.  If so, GlennW suggestion won't work as that is the method for the partner wsdl.

In C# you need to set the date value as you are doing and also set the DateRequestNeeded__cSpecified field on the _case object to true as suggested by zak.

done, thanks

personnal opinion I don't understand why this field exist (...Specified)
some explanation will be appreciated
This is a .NETism to handle type's that might be null in SOAP, but can't be null in .NET (nothing to do with the sforce service itself) see http://www.pocketsoap.com/weblog/2004/07/1461.html for my rant about why its broken.
You can also add your vote to this suggestion to get this fixed in .NET 2.0


Message Edited by zak on 08-03-2004 07:29 AM

Message Edited by zak on 08-03-2004 07:30 AM