1

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
  • 2
    I believe you are passing wrong value in LanguageLocaleKey and LocaleSidKey Pickist. check the value again and try
    – HSdev
    Commented Jan 11, 2017 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
    Commented Jan 11, 2017 at 12:38

1 Answer 1

3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .