function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vmarcovmarco 

Getting pick list keys for User fields?

I'm trying to create a service which eases employee onboarding.  As such my service needs to be able to create users on the corporate SF account.  I'm down to errors on the picklist fields: TimeZoneSidKey, LocaleSidKey, EmailEncodingKey, ProfileId, and LanguageLocalKey.

 

My question is how do I get these picklists?  Are there some standard queries for those?

 

Thanks,

 

Vince

 

matermortsmatermorts

Sorry, not exactly sure what you mean. This worked in my org.

 

SELECT LanguageLocaleKey, LocaleSidKey, ProfileId, EmailEncodingKey, TimeZoneSidKey FROM User

 

Do you mean you're having trouble setting these values?

vmarcovmarco

Well that isn't the full query, right?  I'd need a where clause otherwise the more users the company gets the more users I'm pulling back, just to get 1 value.

 

Here is what I've found so far.  I can use connection.getUserInfo() to get the user info for the parent User that I'm accessing the API through.  The GetUserInfoResult contains all but one of the required fields: EmailEncodingKey.  So I still need a query for that, which I'm trying: SELECT EmailEncodingKey FROM User WHERE Username = <uname> (where <uname> is the username from the GetUserInfoResult.

 

Comment: First, why wouldn't EmailEncodingKey be in the GetUserInfoResult query?  Second, I understand the need for a set of required fields when creating a user.  However, couldn't these fields be defaulted from the parent User account being used to access the API?  It would make using the API a ton easier.  It is essentially what I'm doing to get a user created.

SuperfellSuperfell

the describeSObject call will tell you all the picklist values for the various fields.