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
jmarie1228jmarie1228 

Problem with date and number not saving to salesforce through API

Hi All-
   I'm a newbie and have created a couple of custom objects, and am creating a C# web form that the user completes to post data to the custom object.  All works fine except for the date and quantity field.  The date field is defined as a date in the custom object and the quantity field is defined as a number 3, 0.  I'm sure this is a formatting thing, but I've tired all kinds of date formatting and spent the last hour reading posts on this board without success.  Anyone that can point me in the right direction?
 
Code I'm using for the date field is:

customObjectName.Submitted_Date__c = DateTime.Today.Date;

And quantity field is:

customObjectName.Lost_Qty__c = int.Parse(txtLostQty.Text);

Thanks!

jmarie1228jmarie1228

Never mind....just read the bit in the API docs regarding the "specified" boolean value required for non-string fields:

If you use .Net with the Enterprise WSDL, .Net will generate an extra Boolean field for each non-string field. For example, if you had a date value in MyField__c or the standard field LastModifiedDate, .Net generates a Boolean field for each.

In this example, the generated fields would be MyField__cSpecified and LastModifiedSpecified. These field values are False by default. If a Specified field value is False, then the values in the corresponding original field will not be included in the SOAP message.

For example, before the values in the currency field annualRevenue can be included in a SOAP message generated by your client application, the value of annualRevenueSpecified must be set to True:

account.annualRevenue = 10000;

account.annualRevenueSpecified = true;

Thanks anyway!!
vitolinivitolini
I was having the same problem. That helped me as well...
 
Thanks...