You need to sign in to do that
Don't have an account?
Attempting to use dynamic apex to set a custom object's currencyisocode
Hello!
I've been working on adding multi-currency support to a future app exchange product, and I'm having trouble finding the right logic to set my quote.currencyisocode dynamically.
first I tried:
sobject oppriso = quote.getSObject('Opportunity__r.CurrencyIsoCode');
quote.putObject('CurrencyIsoCode', oppriso);
then:
sobject oppriso = quote.getSObject('Opportunity__r').get('CurrencyIsoCode');
quote.putObject('CurrencyIsoCode', oppriso);
And then I thought maybe:
quote.putObject('CurrencyIsoCode',(string)quote.getSObject('Opportunity__r').get('CurrencyIsoCode'));
All of these methods return compile errors relating to sobject/string type problems. I spent all night working on this, so maybe I'm just snowblind so to speak. Is there a dynamic method for putting a string into a string field on an object?
You were absolutely right. Snowblind indeed.
The final working code ends up being:
quote.put('CurrencyIsoCode',(string)quote.getSObject('Opportunity__r').get('CurrencyIsoCode'));
Thanks a bunch!
All Answers
You were absolutely right. Snowblind indeed.
The final working code ends up being:
quote.put('CurrencyIsoCode',(string)quote.getSObject('Opportunity__r').get('CurrencyIsoCode'));
Thanks a bunch!