I am working with custom soap webservice, I am getting the unit-price amount from external service $399.99 but in sfdc database it is storing as $399 only, the unit-price field is currency(10,3) in salesforce. What is wrong in the below webservice ?
global class MainClass
{
global class Quote-line
{
webservice string uprice;
}
/----------Method begin---------
//I am mapping external unitprice to sfdc firld like below
qlw = new Quote_Item__c();
qlw.Unit_Price__c= integer.valueof(uprice);
}
}
Attribution to: Sathya
Possible Suggestion/Solution #1
You're using Integer.valueOf(string), which will give you an integer .. a wole number without decimal values. If you want to maintain your entire number, you should be using the Decimal.valueOf(string) method.
Attribution to: Samuel De Rycke
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/32644