Development questions

Write a SOQL query to fetch all Case records that have been escalated and have at least one CaseComment created by a Customer Community User.

DevelopmentHardCognizantCapgeminiHCL

Use a semi-join on CaseComment restricted to comments created by Experience Cloud (community) users, combined with the escalation flag.

soql
SELECT Id, CaseNumber, Subject FROM Case
WHERE IsEscalated = true
  AND Id IN (SELECT ParentId FROM CaseComment
             WHERE CreatedBy.UserType IN ('CspLitePortal', 'PowerCustomerSuccess', 'CustomerSuccess'))

The UserType values identify Customer Community and Customer Community Plus users; check the exact values used in your org.

soqlscenariosemi-joinexperience-cloud