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
MaverickDevMaverickDev 

Populate lead custom field (multiselect picklist) dynamically

Hi,

 

I've created a custom field (i.e.. multi-select picklist) in Lead section. The requirement is to populate it dynamically. I'm getting response from the web service in JSON format and I wish to bind the same to custom field.

 

I can do this easily in VF pages but how to achieve this for Lead custom field. Let me know, if this possible!

 

Thanks!

crop1645crop1645

Multi-select picklist fields are manipulated in APEX by using a String variable with picklist values separated by semi-colons. You can see this by creating a Lead with a multi-select field through your UI  then using Data Loader or the SFDC workbench to query the value

MaverickDevMaverickDev

Thanks Eric for your reply!

 

Is it possible to write a class to populate picklist values programmatically?

What you think?

 

- Shailesh

crop1645crop1645

Maverick

 

1. If you want your VF page to have a multi-select field with custom entries, then yes, this is easy to do with a VF controller and the use of the apex component selectOption. However, the list you use should be drawn from the allowed values for that field.  

 

2. If you want to dynamically manipulate the metadata of your SFDC custom field, you'll need to use the metadata API - and this is a whole new topic in and of itself