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 

CurrencyIsoCode mapping is not working 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.
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;

Thanks in advance,
Best Answer chosen by Soundar Rajan Ponpandi
AnudeepAnudeep (Salesforce Developers) 
Hi Sounder, 

Can you try updating the opp.CurrencyIsoCode on an existing opportunity in your org through workbench using Metadata API and see if the value is getting changed? 

Also, can you set your corporate currency to a different value and verify if you are seeing the same issue?

As per this documentation, changing the user's default currency does not fix the issue