Recently I started to get an error trying to update user details in scratch with multicurrency enabled
Here is apex code I use:
String phoneNumber = '+1 12345678';String countryName = 'United States';String userId = UserInfo.getUserId();User user = [SELECT Id, Name,MobilePhone FROM User WHERE Id =: userId LIMIT 1];user.MobilePhone = phoneNumber;update user;
When running this i got the following error:
System.DmlException: Update failed. First exception on row 0 with id 00501000003yJq2AAE; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, Currency ISO Code: invalid currency code: 000: [CurrencyIsoCode]
Scratch definition file;
{ "orgName": "vk02 Org", "edition": "Developer", "features": ["MultiCurrency"], "username": "vk02@xxx.com", "adminEmail": "vk02-1@xxx.com", "language": "en_US", "country": "US", "settings": { "currencySettings":{ "enableMultiCurrency": true } }}Previously this worked but now is error (from beginning of this week). Is something changed in salesforce?
2 respuestas
I found what was the matter, the api for creating a scratch has changed, before it was necessary to specify in scratch-def.json:
"features": ["MultiCurrency"]
became:
"settings": {"currencySettings": {"enableMultiCurrency": true}}