You need to sign in to do that
Don't have an account?
Isaac Gomolka
How to assign picklist option
Hi everyone, I need to use apex code to assign a picklist option value to a certain user's field. Basically im automatically creatinga new user using apex, and so its automatically assigning a bunch of the fields. Some of those fields are picklists and are required to create a new User. So im wondering how to / whats the code for assigning a specific picklist option. Like how do I get that specific options ID or something. Thanks for the help!
For example, this is basically what I need to do, just don't know how.
newUser.LocaleSidKey = picklistName.picklistOption;
For example, this is basically what I need to do, just don't know how.
newUser.LocaleSidKey = picklistName.picklistOption;
All Answers
Thanks for the response. Is that actually how it's done? Because i tried doing that and assigning it as a string, but then when i tested it by printing it out on my visualforce page im working with, nothing showed up.
I would do this in my apex class:
newUser.localeSidKey = 'English (United States)';
and then this in my VF page:
<apex:outputField value="{!newUser.localeSidKey}"/>
and nothing would show up. Am i doing it wrong somehow? Thanks for the help, i really appreciate it!