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
bca321bca321 

Currency error

Hi,

 

I tried to convert currency value String to decimal type.

 

String a = '';
            Decimal DebitAmount;
            a='';       
            if((a<>null)&&(a<>'')){
            DebitAmount = decimal.valueOf(a);
            }
            system.debug('\n\n String a='+a);
            system.debug('\n\n Decimal DebitAmount='+DebitAmount);

 

And this value I insert to salesforce.

 

My regular expersion is (\\d*\\,*\\d+.\\d*)

 

DebitAmount = decimal.valueOf(m.group(1).replace(',',''));

newReceipt.Debit_Amount__c = DebitAmount; 

insert newReceipt;

 

Currency ex: 66,967.78 But after insert the salesforce this value convert to as a  rounded  value. (66,968). But I want to actual value. Not the rounded value. How can I do it.

PamSalesforcePamSalesforce

Hi,

 

I want to convert a string s ='144,00' to currency

 

Please help.

 

Thanks,