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
nelrib88nelrib88 

Help with creating a dropdown (picklist)

im new to apex code and im trying to create a new tool for use in salesforce that will allow someone to segment their campaign.  i would like to create a filter criteria section like the one found in manage compaign members when u go about adding contacts/leads to a campaign. Can someone please provide the code or help me create the drop down picklists under the Field section. i know how to manually add items to the list but i would like to do in such a way that the picklist is created dynamically based on the fields the current user has available for contacts/leads.

 

thanks,

NR

sfdcfoxsfdcfox

You use an apex:selectList (in a Visualforce page), and then populate this list dynamically at runtime using apex:selectOptions. There's examples in the Visualforce documentation. Unfortunately, you can't create a dynamic list in the standard UI at all; it requires Visualforce to create this sort of list.