0

Is there a way to get Contacts with no cases? There is no lookup on the Contact object so not sure if its possible so I tried below but no luck

I used

select id, subject, description, contact.id, contact.name, contact.phone, contact.email from case where id = null and contact.email like '%noemail%'

Thank you

1 Answer 1

3

SELECT Id FROM Contact WHERE Id NOT IN (SELECT ContactId FROM Case) LIMIT 10

Thanks

4
  • Thanks for that. I've seen some similar queries where you had to use the exact relationship/lookup name. The Contact object doesnt have a look up relationship how is it possible that you're able to find the Case in this example? May 12, 2022 at 11:07
  • In this case this is two independent queries. Limit here is left and right side must point to the same object type
    – Pavlo M
    May 12, 2022 at 13:55
  • Is it possible to run the same query against livechat transcript? SELECT Id, name, email, phone, account.name FROM Contact WHERE id not in (select contactid from livechatranscript) If you're able to point me to some documentation that would be great. Thank you for your help May 12, 2022 at 23:51
  • The Docs I found - developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/…
    – Pavlo M
    May 13, 2022 at 7:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .