4

I need to create a picklist field, that will have an option to add values that are NOT in the original list. The values are coming from a SF form.

  1. If you add the new data today, it is inserted, and shown in reports - but it can NOT be selected in filters and/or bucket values.
  2. This option should also be available from the SF interface

I thought of having a text field, that if there is data there, it should be added to the picklist values, but I am not sure that it's the way.

For example: I have a picklist with name list: John, Jane, Jo

Someone needs to enter a new value: Boby

Boby will NOT be visible, even if I would like to change Boby to something else in the picklist field edit page, I will not see it.

I will need Boby to be added as a valid value.

  • 3
    Be aware that there is a maximum limit of 15000 characters / 1000 entries on a picklist, so if you build a mechanism which allows users to add them you may need to consider housekeeping the data somehow too. – Doug B May 21 '13 at 13:44
7

To add additional values to a picklist, you need to use the Metadata API. Take a look at this GitHub project to see how it is possible to access the Metadata API from within Apex. I think you should be able to do an update of the picklist field with new values. Take a look at the documentation on the picklist component

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.