function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BasilBasil 

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;
binding.create(so);

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#

thanks

GlennWGlennW

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

2004-07-29T09:30:00Z

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

Cheers;
GlennW

BasilBasil

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

 

thanks

zakzak
remember to set the DateRequestNeeded__cSpecified flag to true.
DevAngelDevAngel

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.

BasilBasil
done, thanks

personnal opinion I don't understand why this field exist (...Specified)
some explanation will be appreciated
zakzak
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
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=bb1331f3-6b2c-4d3e-851a-5830e9c3cf2d

Cheers
Simon

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

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