We use our homebrew shop system together with Salesforce and Financialforce. Invoices are created and send by our shop system. After an invoice is created it will be transmitted to related Salesforce account by SOAP-API (we can also use REST). Invoices are stored in Salesforce/FF object c2g__codaInvoice__c, related line items in c2g__codaInvoiceLineItem__c. Next year we want to use Salesforce for billing (for another shop we use it already).

Unfortunately transmission of account currency by SOAP had a bug, now we have many Salesforce accounts with wrong currency, e.g. EUR in shop / USD in Salesforce/FF. Since invoices for many affected accounts are already posted, we cannot edit accounts currency fields CurrencyIsoCode and c2g__CODAAccountTradingCurrency__c.

So, is there any way to change affected accounts currency by Apex code? Loss of invoices is acceptable (they are stored in our shop), but I would not like to delete and recreate accounts.

Regards Obi


I think you can update CurrencyIsoCode field on Account. You just need to query those records and update currency.

Account ac = new Account(Id='001g200001ypb9W', CurrencyIsoCode = 'AUD');
update ac;
  • But problem is that related invoices are already posted, so updating account leads to message "account is already in use" and currency cannot be updated. Maybe I can remove posted invoices? – Obi_77 Dec 16 '18 at 10:32
  • Yes...I think so...also...it does not seem error is Salesforce standard...it seems related to billing package that you are using... – Ayub Dec 16 '18 at 11:41
  • @obi_77 _ agree w/ ayub -- for example, you can't change the currency of an OpportunityLineItem - you need to delete all line items, then change currency of Opportunity, then add back opportunityLineItem. Your invoice - account system c2g__ may have similar restrictions – cropredy Dec 18 '18 at 2:09

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.