1

while inserting user object data in Test Class

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, Locale: bad value for restricted picklist field: English(Ireland,Euro): [LocaleSidKey]

how to insert localesidkey and Locale Value for user using apex class

  • Can you post your code where you set the User object. Also try English(Ireland) for Locale. – highfive Apr 26 '16 at 6:57
1

Here you have an example of how create a user in apex

Example:

 Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; 
        User u = new User(Alias = 'standt', Email='standarduser@testorg.com', 
            EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
            LocaleSidKey='en_US', ProfileId = p.Id, 
            TimeZoneSidKey='America/Los_Angeles', UserName='standarduser@testorg.com');

List of Locales and corresponding codes (LocaleSidKey) with its formats for Date, Names and Numbers can be found in Supported Locales.

| improve this answer | |
  • 1
    Thx @vigneshwaran-g for add the list of supported locales. – Torsen Apr 26 '16 at 7:08

Your Answer

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