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
vivek ravivivek ravi 

can we use soql query in set method

im just wan o control the dublicate in emails ids in the contacts in accoun so that i wan to use set method

can i write my query like this

set <contact> conids=[select id,email from contact where id=:accountid];
set <id> contactemail=new set<id>();
for(contact con:conids)
{
contactemail.add(con.id)

}
can i write like this
if any one knw help me in this
Ashish_SFDCAshish_SFDC
Refer below, 

https://developer.salesforce.com/forums/ForumsMain?id=906F00000009smQIAQ

Ulas KutukUlas Kutuk
No you can not query like this. Should query w/ using List and then you can itare over list and add to whatever Set you want.