0

I need create user via apex with specific lang and country. For example with lang French and country Switzerland. I am trying create user with fields:

LanguageLocaleKey='fr_CH',
LocaleSidKey='fr_CH',

But using the above values causes this error::

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, Language: bad value for restricted picklist field: fr_CH: [LanguageLocaleKey]

  • 2
    I believe you are passing wrong value in LanguageLocaleKey and LocaleSidKey Pickist. check the value again and try – HSdev Jan 11 '17 at 12:34
  • Yes. I have figured out with it. I am using LanguageLocaleKey = 'fr' and LocaleSidKey='fr_CH' and all works fine. Anyway thank you for helping! – JKasyan Jan 11 '17 at 12:38
1

Congrats on self-curing. For the next person who runs into this issue, the valid values for a restricted picklist can be found by using any of the Metadata browsers that use the Describe API call. A good example is Workbench. This is what it looks like for SObject User

enter image description here

Be sure to use the picklist's value attribute "value", not the label.

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.