6

When creating my Scratch org, I've added the MultiCurrency feature, and that works, but I still need to go in manually to add the currencies and set the company currency. Is it possible to to this via CLI, so scratch orgs can be more scripted?

7

Yes, you can insert currencies and change the corporate currency via the API. A quick way of doing this is sfdx force:data:tree:import -f CurrencyTypes.json where CurrencyTypes.json contains the following:

{
  "records": [
    {
      "attributes": {
        "type": "CurrencyType",
        "referenceId": "ref1"
      },
      "IsoCode": "INR",
      "DecimalPlaces": 2,
      "ConversionRate": 1.5,
      "IsActive":true,
      "IsCorporate": true
    }
  ]
}

Importing this into my scratch org, which was created with a default currency of GBP, (my scratch definition has a country of "GB"), resulted in my corporate currency becoming INR, and GBP being updated with an appropriate conversion rate to the corporate currency.

  • I might add that to change the corporate, one must set the new corporate currency before unsetting the old. – specimen Sep 11 '18 at 8:09
0

The metadata API doesn't support currency exchange rates, so you can't automatically set up multiple currencies. This is still, unfortunately, a manual process.

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.