Print this page

Converting the Currency value to integer using Apex

Knowledge Article Number 000220930

This article specifies one way to convert the currency value to integer.

Use case: Convert Currency data type to Integer


The method valueOf can be used to convert the currency to integer. 

Sample Code:
Here the AnnualRevenue column in Account object is of type currency.  This value is converted to integer and added to list quarterBonus. 

Account acc1 = [select AnnualRevenue from account where AnnualRevenue != null limit 1];

System.debug(‘Annual Revenue: ' + acc1.AnnualRevenue);

list<integer> quarterBonus = new list<integer>(1);

system.debug('Quarter Bonus: ' + quarterBonus[0] );

Please note that this is just a sample code and may not satisfy your complete business needs.

Dev Doc: Integer Class 

promote demote