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.
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
More Development questions
- What is an Apex Trigger in Salesforce and when should you use it over Flows?
- What is the difference between before triggers and after triggers?
- Explain all Trigger context variables (isInsert, isUpdate, isDelete, isUndelete, isBefore, isAfter, isExecuting, size, operationType).
- What is the difference between Trigger.new and Trigger.old?
- In which trigger events are Trigger.new and Trigger.newMap available?
- In which trigger events are Trigger.old and Trigger.oldMap available?