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
eric_wceric_wc 

return contacts based on a multi select picklist of account names

I am still learning apex and vf but I know this cannot be hard but I cannot figure it out.  I have a custom object that has a mutli-select picklist that contains some account names.  I need to create a page that will list out all the contacts associated to the accounts selected in that multi-select picklist.

 

Thanks for any help you can provide.

 

Eric

jeremyyjeremyy

Are the multi-select picklist just Account names? If so, you'll have to build a list of the account names from the selected values, then use those values in a relationship query, like:

 

SELECT Id, Name (SELECT Id, FirstName, LastName FROM Contacts) FROM Account WHERE Name IN :accountNameList

 

 

eric_wceric_wc

Thanks that got me going in the right direction.

 

Eric