Execute a SOQL or Anonymous apex code every minute
I have a requirement where I need to execute a SOQL on Contact object every minute from 4 am to 5 am and capture the results for every execution. I don’t want to create a batch apex and schedule it to execute every minute since this is only for troubleshooting a production issue.
Is there a way to execute the SOQL automatically from 4 am to 5 am? Or is there a way to execute this piece of apex code from “Execute Anonymous” windows automatically from 4 am to 5 am?
Thanks in advance.
Adding Additional Info:
We have one particular contact that gets deactivated every day morning between 4 to 5 even we activate it every day. We have several batch jobs running from midnight to 6 AM. So, I just want to execute a SOQL query or apex code to query the status of the contact after every minute and figure out which batch job is flipping the status of the contact from Active to Inactive.
Read more here: Source link
