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
debprakash shawdebprakash shaw 

we have three type of contact ,how to filter based on condition

I have three types of contact that are level1, level 2, and level 3, and level 2  and level 3 are linked to level 1
here I want to write a class and I want to filter it based on like
Delete Level 1 Contact which does not have Levels 2 & 3 and level 1 email have ''

Please give the suggestion on how to write the SOQL for this scenario



Siva Krishna KondapalliSiva Krishna Kondapalli
Please frame the query properly, as per your query you mentioned here 
if level2 and level3 are linked to level1 there might some come field or relation among themselves
i think for this you could write a trigger by comparing the contact ids of level1,level2 and level3
or else you could also call the linked level2 and level3 records through parent to child relationship SOQL Query.
debprakash shawdebprakash shaw
Hi Siva, thanks for the quick response,

Can you please write the SOQL query for that
and the relationship field names " Parent_Member_Name__r" 

thanks in advanced