I want to batch delete all completed activities on a lead page with the subject 'callback.' The following pictures show the Batch Apex Class and Batch Test I have but they are not working. Does anyone have any tips?
1. Create new apex class and paste the code as mentioned below:
global class DeleteAllTaskScheduler implements Schedulable{
global void execute(SchedulableContext sc) {
DeleteAllTask batch = new DeleteAllTask();
Id batchId = database.executeBatch(batch,50);
}
}
2. Now open the Developer Console 3. Click on the Debug drop-down at the top left corner. 4. Now Select Open Execute Anonymous window. 5. Clear everything in the window and paste the code as mentioned below:
6. Now click on the Execute button and make sure that there is no error. 7. Now you can check in your scheduled jobs that the batch is scheduled to run on the daily basis at 10:00 pm.
Please let me know if you still need any other help.
Your batch class looks fine to me. Have you ran your batch class or schedule it from developer console? What is not working for you? Test class is not showing proper coverage or batch is not running properly through developer console? Please clarify.
I probably haven't run or scheduled it! This is the first time I've done a batch so I'm not exactly sure how it works. I pushed it from developer to production but do I need to do something else also?
You need to follow the below mentioned steps in order to run this batch every night:
Create a scheduler class for this batch.
Create a crone expression that will schedule this class to run every night.
Now using developer console you can schedule your batch class.
Please let me know if you need any further help on this. You can also contact me on Gmail or Skype if anything is urgent: Gmail: abhibansal2790@gmail.com Skype: abhishek.bansal2790
Thanks Abhishek - I actually do need help with this as I have never built any of those before! If you have time would you send me what those should look like?
1. Create new apex class and paste the code as mentioned below:
global class DeleteAllTaskScheduler implements Schedulable{
global void execute(SchedulableContext sc) {
DeleteAllTask batch = new DeleteAllTask();
Id batchId = database.executeBatch(batch,50);
}
}
2. Now open the Developer Console 3. Click on the Debug drop-down at the top left corner. 4. Now Select Open Execute Anonymous window. 5. Clear everything in the window and paste the code as mentioned below:
6. Now click on the Execute button and make sure that there is no error. 7. Now you can check in your scheduled jobs that the batch is scheduled to run on the daily basis at 10:00 pm.
Please let me know if you still need any other help.
Please follow the steps as mentioned below:
1. Create new apex class and paste the code as mentioned below: 2. Now open the Developer Console
3. Click on the Debug drop-down at the top left corner.
4. Now Select Open Execute Anonymous window.
5. Clear everything in the window and paste the code as mentioned below: 6. Now click on the Execute button and make sure that there is no error.
7. Now you can check in your scheduled jobs that the batch is scheduled to run on the daily basis at 10:00 pm.
Please let me know if you still need any other help.
Thanks,
Abhishek Bansal.
All Answers
Hi Clarie,
Your batch class looks fine to me. Have you ran your batch class or schedule it from developer console? What is not working for you? Test class is not showing proper coverage or batch is not running properly through developer console? Please clarify.
Thanks,
Abhishek Bansal.
You need to follow the below mentioned steps in order to run this batch every night:
Please let me know if you need any further help on this. You can also contact me on Gmail or Skype if anything is urgent:
Gmail: abhibansal2790@gmail.com
Skype: abhishek.bansal2790
Thanks,
Abhishek Bansal.
Please follow the steps as mentioned below:
1. Create new apex class and paste the code as mentioned below: 2. Now open the Developer Console
3. Click on the Debug drop-down at the top left corner.
4. Now Select Open Execute Anonymous window.
5. Clear everything in the window and paste the code as mentioned below: 6. Now click on the Execute button and make sure that there is no error.
7. Now you can check in your scheduled jobs that the batch is scheduled to run on the daily basis at 10:00 pm.
Please let me know if you still need any other help.
Thanks,
Abhishek Bansal.