Here is my requirement.
- User A can do a check in (through click of a button) which creates a record in custom object "CheckIn__c" and the following fields will be populated: [CheckInTime__c] - current time [Duration__c] - duration in minutes [Supervisor__c] - user will select the supervisor user in this field.
- There is a formula field [ScheduledCheckOutTime__c] which is [CheckInTime__c + Duration__c].
- User A can check out using another button which will populate the [CheckOutTime__c] field.
- If user forgets to checkout before the [ScheduledCheckOutTime__c] then an SMS should be sent to the Supervisor twice - (1). 5 mins after ScheduledOutTime, (2). 20 mins after ScheduledCheckOutTime.
- User A can extend the check in by adding more minutes to the Duration field which will automatically extend the [ScheduledCheckOutTime__c].
The challenge is what is the best way to implement the SMS functionality. We tried the following options:
- Batch Apex which runs every 15 mins to see if there is an expired check in and sends SMS. Cons: We could NOT achieve the 5 mins & 20 mins timeline exactly.
- Time Based Workflow: this approach works fine only when the interval is more than 1 hour from any date time field. We are dealing with minutes here.
As of now, the only option we have is to reduce the batch job interval to 5 minutes.
Can anyone think of another way to implement this?