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
mandymandy 

Updating Sforce currency field problem

Hello,

I'm struggling to update a currency field in Salesforce. Here is my code:

-------------------------------------------------------------------------------------------------------
Dim o As SalesForceAPI.Opportunity = New SalesForceAPI.Opportunity
o = opp
o.Actual_Revenue__c = CDbl(revenueRow.SUM_RECEIVED)


Dim sr As SalesForceAPI.SaveResult() = sforce.update(New SalesForceAPI.sObject() {o})
For d As Integer = 0 To sr.GetUpperBound(0)
    If sr(d).success Then
        Console.Write("Success")
    Else
        Console.Write(sr(d).errors(0).message.ToString & vbCrLf)
    End If
Next d
-------------------------------------------------------------------------------------------------------
I tried hard-coding a number in place of revenueRow.SUM_RECEIVED in the above code for debugging purposes but that did not work either.

If I change the sforce field type to text and remove "CDbl" from the above code the update works perfectly. Any advice how I can insert a numeric value into the currency field, Actual_Revenue__c?

Thank you in advance for your help!
Mandy
Best Answer chosen by mandy
SuperfellSuperfell
You need to add
o.Actual_Revenue__cSpecified = true

so that .NET will actually send that value over the wire.

All Answers

SuperfellSuperfell
You need to add
o.Actual_Revenue__cSpecified = true

so that .NET will actually send that value over the wire.

This was selected as the best answer
mandymandy
THANK YOU!! That worked perfectly!