4

I'm working on a small application in which I want the user to be able to enter a conversion rate on a VF page. The conversion rate should be saved in the CurrencyType object. I wanted to use something like this:

CurrencyType ct = new CurrencyType(ISOCode = 'GBP');
ct.ConversionRate = 4.0; //or some variable
upsert ct ISOCode;

But if I try to save this code I get the following error: DML not allowed on CurrencyType. How can I update the conversion rates from Apex?

Edit; If I change the upsert to update I still get the same error message; DML is not allowed on CurrencyType. Is there any other way to do an update in Apex, besided DML?

1

see below the supported calls for this object.

Supported Calls create(), describeSObjects(), getUpdated(), query(), retrieve(), search(), update()

*Note that upsert() is not supported. You need to query the object and then perform update().

  • 1
    Thanks for your answer, but again, this is for the API, I want to do this directly from Apex. – rael_kid Jun 26 '13 at 13:16
  • Hi, the answer is the same, this object does not support upserts unfortunately... – dacology Jun 26 '13 at 13:29
0

Looks like API is the only option, cant be done from apex

See this post for details on how to do so

And here is an idea to allow for this in apex

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.