I have recently converted a really long Picklist field that contained lots of Users to a custom lookup field (to make it neater and manageable e.g. not having to add users manually) however, the old Picklist field also had 'text options' as well as those manually inputted users names.

Is there a way to add those 'non user' text options to the list of users?

UPDATE from questions:

  • As well as the referenced names the lookup should also contain 'text' words fields 'no preference', 'dept A user', 'dept B User' if the user doesn't know which one to pick
  • The lookup currently looks at the USER object
  • You old picklist has multiple users but ur look up field will always point only to one user.what about the other users in the list and what exactly you want to add.As far as user is concerned,only users will be shown in the list.you can not show any non user in the list – Samir Feb 23 '17 at 16:50
  • @Samir I do want it to show the users --- sometimes the person may not know which user to choose so the picklist also contained 'no preference', 'dept A user', 'dept B User'.... I just want to add some 'text' to the list as well as the lookup's referenced users. – TheAdmin Feb 23 '17 at 16:57
  • Your custom lookup points to USER object..Right? – Samir Feb 23 '17 at 16:58
  • @Samir Yes, the custom lookup points to USER – TheAdmin Feb 24 '17 at 8:38
  • The lookup will only contains the list of user in SF.To add something like TEXT , you will need to create a user of that name.Or you can one custom object and populate it with the user name and add the text you want as well in that object.You look up will now point to this new object – Samir Feb 24 '17 at 10:14

Pseudo Code to be run in Anonymous block

    list<User> lstUser = new list<User>();
    lstUser = [SELECT FirstName,LastName FROM User];
    //newObj__C is new custom object
    List<newObj__C> obj = new List<newObj__C>();
    for(user u : lstUser){
        String name = u.firstName + ' ' + u.LastName
        obj.add(new newObj(name = name);

Database.insert (obj);

Please mark it as the answer if this answers your question

| improve this answer | |
  • What is newobj? – Mahmood Feb 24 '17 at 12:46
  • it will be the new custom obj that has to be created – Samir Feb 24 '17 at 13:18

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.