Recently I got a requirement to schedule email alerts based on business hour for any record creation in custom object. Below are use case and requirement.
Use Case :
We have a custom object, when record is created in that object send a email to user after 2 hour of record creation. Email will be sent in business hour only.
Business Hour is set to 10AM-6PM for each working day. Saturday and Sunday are holiday.
Requirement:
If record is created at 5PM then system should sent email at 1 PM next day.
If record is created at 5PM on Friday then system should sent email at 1 PM next Monday.
Solution:
To solve this use case, we will need to do below tasks
- Create a custom field in object to store reminder time.
- Create Custom Setting for Reminder Time
- Create InvocableMethod class to get next business date
- Create a Email Template and Email Alert for Notification
- Create process builder to schedule action based on custom field created
- Test functionality
I got Reference from this link to solve my issue and you can also follow the same to resolve your issue. Reference Link: SCHEDULE EMAIL ALERTS BASED ON BUSINESS HOURS