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
ira42ira42 

Adding values to custom picklist on the fly?

I'm using a web-to-lead form.  One of the custom fields in SFDC is a picklist.  On my web form,  I don't want a picklist,  but rather a text field.

 

Is there a way to dynamically build the picklist from the textfield values submitted by the web form?

 

In other words,  if the picklist was for 'favorite color', and the preset values were "blue", "red", and "green",  but someone enters "purple" on the w2l form,  "purple" is subsequently available in the SFDC picklist on the 'edit leads' pages?

 

Thanks! 

jkucerajkucera

This post has some details on how to use the metadata API to add values to a picklist using C#.  I'd imagine you can use most of it in regular apex:

http://community.salesforce.com/sforce/board/message?board.id=NET_development&message.id=7024

 

If SOQL had GROUPBY functionality, you could make your field a text field & display it as a picklist using VF, but alas, no GROUPBY.  Vote for the idea here:

 

http://ideas.salesforce.com/article/show/72681/GROUP_BY_in_SOQL

ira42ira42

Tx,  I'll check out the link (and the feature request!).

 

Cheers,

 

Ira