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
Soundar Rajan PonpandiSoundar Rajan Ponpandi 

How to map CurrencyIsoCode in apex class ?


I have enabled multi currecny in my organisation.

1. I like to map "CurrencyIsoCode" in apex class. But it's not mapping, let's say for example i am selected a value from currency dropdown as USD in a lead object (Custom Object).

2. While convert to opportunity lead currecncy should map with opportunity currecncy. but always it's taking a corperate currecny.

3. Can you please give me a valid suggestion why this multi currecny is not mapping in apex code.
opportunity.CurrencyIsoCode = leadRecord.CurrencyIsoCode;
insert opportunity;

Thanks and Regards,
Soundar Rajan P.
ShirishaShirisha (Salesforce Developers) 
Hi Soundar,


As far as I know,the provided format is the correct way of mapping the CurrencyISOCode but not sure,why this is not working as expected.


Also,please check the sample code for after trigger to update the Opportunity field and add the above logic in the trigger to see,if it works.

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri

Soundar Rajan PonpandiSoundar Rajan Ponpandi
HI Shirisha,

CurrencyISOCode is not working for my code,  Please review and correct me if i did any mistake.
public static Id convertToOpportunity(GD_Lead__c leadRecord) {
        Opportunity opp = new Opportunity();
        opp.GD_Lead__c = leadRecord.Id;
        opp.stageName = 'Qualification';
        Opp.CloseDate = Date.Today().addDays(30);
        opp.CurrencyIsoCode = leadRecord.CurrencyIsoCode;
        system.debug('Opp ' + opp.CurrencyISOCode + ' Lead ' + leadRecord.CurrencyISOCode);
        insert opp;

Else should i create any ticket for salesforce ?