I have users and users will fill fields in Account object. there is custom field "Approval status__c" - Pending, Accepted, rejected. my query is Send Email to System Admin to Accept / Reject an Account. Send this Email on 10th day of the date of creation. If not accepted / rejected, again send on 13th day, 15th day. If not accepted / rejected, then the Account must get rejected automatically.
How can i do this without and with code both.
Hi Chetan,
You'll want to do this with a record-triggered flow with a scheduled path. Start by creating a record-triggered flow on the account object, running on create or update, with the criteria that approval status is Pending. Optimise for actions. If you click on the blue Start step in the flow builder, you'll see a section for scheduled paths. Create a new path that runs 10 days after the flow execution time. This will create a new path from the start step that will be executed 10 days later, as long as the approval status was not changed from Pending to something else.
In here, you can add a Send Email step to send a message to an administrator.
With code it's actually a bit trickier. We don't normally execute one-time scheduled actions with Apex - flows are the correct approach to deal with this. If you really wanted to, you could use a scheduled Apex class to make something that runs on a particular date and time, and then use a trigger to schedule or unschedule that class based on record criteria. But it's a very large effort that's completely unnecessary.