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
sanjusfdcsanjusfdc 

Get Contact and Leads that have not been associated with any campaign

Hello all,
How to get all contacts and leads under the names of user1 that have not been added to any campaign?
I am trying using workbench because user wants in excel sheet.
Thank in advance.
SubratSubrat (Salesforce Developers) 
Hello Sanju ,

Can you elaborate any difficulties that you are facing while export ?

Thank you.
 
sanjusfdcsanjusfdc

Hi Subrat,
I tried something like
AND((select Id, Name, Email, Phone from Contact where Owner.Name = 'User1'
AND Id NOT IN (select ContactId from CampaignMember)),
(select Id, Name, Email, Phone from Lead where Owner.Name = 'User1'
AND Id NOT IN (select LeadId from CampaignMember)))

i started one one line based on my question. Please suggest me where I am doing mistake?