+ Start a Discussion
Tim KolbTim Kolb 

Problem Updating Double Typed Custom Fields


The Date and Double fields are not getting updated.  Is there something I'm doing wrong?  Sting fields update as expected.

wsdl definitions:

                <element name="SRA_CloseDate__c" nillable="true" minOccurs="0" type="xsd:date"/>
                <element name="SRA_CreateDate__c" nillable="true" minOccurs="0" type="xsd:date"/>
                <element name="SRA_Notes__c" nillable="true" minOccurs="0" type="xsd:string"/>
                <element name="SRA_Probability__c" nillable="true" minOccurs="0" type="xsd:double"/>
                <element name="SRA_SaleAmount__c" nillable="true" minOccurs="0" type="xsd:double"/>
                <element name="SRA_Status__c" nillable="true" minOccurs="0" type="xsd:string"/>
                <element name="SRA_Units__c" nillable="true" minOccurs="0" type="xsd:double"/>
                <element name="SRA_Worksheet__c" nillable="true" minOccurs="0" type="xsd:string"/>

VB.Net Code:

                ' Only need one opportunity in the array
                Dim objOppx(1) As SFWebReference.Opportunity                            ' Create Array
                Dim updateOppx As New SFWebReference.Opportunity               ' Create Opportunity object

                ' Set Opportunity Values
                updateOppx.Id = OpportunityID
                updateOppx.SRA_Worksheet__c = SRADocument          ' String
                updateOppx.SRA_Status__c = Status                               ' String
                updateOppx.SRA_Probability__c = 10                              ' Double
                updateOppx.SRA_Units__c = 1                                        ' Double
                updateOppx.SRA_SaleAmount__c =100                         ' Double
                updateOppx.SRA_Notes__c = Notes                               ' String
                updateOppx.SRA_CreateDate__c = DateTime.Parse("10/14/2011 11:46 AM")                ' Date
                updateOppx.SRA_CloseDate__c = DateTime.Parse("10/14/2011 11:46 AM")                  ' Date

                objOppx(0) = updateOppx                       
 
                ' Update the Opportuinty
                Dim sr() As SFWebReference.SaveResult
                sr = SfService.update(objOppx)                ' Update all array objects
Best Answer chosen by Tim Kolb
William LópezWilliam López
If I remember right you also need to set the  Specified value to true.

For instance using c# will be something like this:

if you have the field 

updateOppx.SRA_Probability__c = 10;

You will also have a field call it  "SRA_Probability__cSpecified" and you need to set that one to true, so salesforce will know a change need to be done.

updateOppx.SRA_Probability__cSpecified = true;

Please let me know if its helps.

All Answers

William LópezWilliam López
If I remember right you also need to set the  Specified value to true.

For instance using c# will be something like this:

if you have the field 

updateOppx.SRA_Probability__c = 10;

You will also have a field call it  "SRA_Probability__cSpecified" and you need to set that one to true, so salesforce will know a change need to be done.

updateOppx.SRA_Probability__cSpecified = true;

Please let me know if its helps.
This was selected as the best answer
Tim KolbTim Kolb
Thanks Bill,

That worked.  It's interesting that you don't need to do that with string fields.
William LópezWilliam López
Glad to hear it worked. Yes its just for numbers and Dates.

Can you mark Question as solved ? so it will help other .Net developers.

Thanks