salesforceapexsoqlsalesforce-service-cloud

Check if record has inactivity in last 4 hours


Below is my scenario :

I have this query which gives me a record which are updated in last 4 hours. And I'm writing this logic in a class that I will be scheduling to run after 1 hours.

 List<Case> casesUpdatedInLastFourHours = [select id, Subject, LastModifiedDate from Case where LastModifiedDate = TODAY AND HOUR_IN_DAY(LastModifiedDate) > 4];

But how can we get records which are not modified in last 4 hours? Any help of suggestion is highly appreciated.


Solution

  • Just make a record trigger flow to execute after 4 hours after creation under your conditions. Then set a checkbox to true and use that as your alarm to fire your logic. Or even better yet, not do the checkbox at all and just fire the email. should be like 2 or 3 nodes altogether. no code