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
Sowjanya Hegde 13Sowjanya Hegde 13 

Convert Integer to Currency

Hi,

I'm getting the value as Integer from the http response. I need to store this value in Currency field in Salesforce. How to convert this Integer to Currency data type. Please help!

Thank you!
ShirishaShirisha (Salesforce Developers) 
Hi Sowjanya,

Greetings!

Please refer the sample code to convert the Integer to currency:

https://community.quickbase.com/communities/community-home/digestviewer/viewthread?MessageKey=d05230df-28a6-4a8c-a55c-cdb0611bfbd4&CommunityKey=d860b0f8-6a48-487b-b346-44c47a19a804&tab=digestviewer

Please mark it as best answer if it helps you to fix the issue.

Thank you!

Regards,
Shirisha Pathuri
Malika Pathak 9Malika Pathak 9

Hi Sowjanya,

please find the below solution

// Read integer number
Integer d = 2398;
// prepend currency symbol
String strFormattedCurrency = '$' + string.valueOf(d);
// Your currency to be printed is ready
system.debug('@@@@ strFormattedCurrency : '+strFormattedCurrency);

If you find this helpful mark it as the best answer.