You need to sign in to do that
Don't have an account?

Help - scheduled apex test class
I've written this scheduable apex class but I can't figure out how to write a test class.
global class UpdateCSMTeam implements Schedulable { global void execute(SchedulableContext ctx) { // Create a list of the accounts to update List<Account> myList = new List<Account>(); // Create a list of all the customer accounts List<Account> accountList = [SELECT Id, Account_Manager__c FROM Account WHERE Type = 'Customer']; for (Account acc : accountList){ // one if(acc.Account_Manager__c == '0051I0000027OCuQAM') { acc.Onboarding_Specialist__c = '0051I0000029k0yQAA'; acc.Product_Specialist__c = '0051I0000027ODJQA2'; myList.add(acc); } // two if(acc.Account_Manager__c == '0051I0000029k3sQAA') { acc.Onboarding_Specialist__c = '0051I0000029k0ZQAQ'; acc.Product_Specialist__c = '0051I000002Q8XaQAK'; myList.add(acc); } // three if(acc.Account_Manager__c == '0051I000002baVoQAI') { acc.Onboarding_Specialist__c = '0051I000002slVdQAI'; acc.Product_Specialist__c = '0051I000002QShlQAG'; myList.add(acc); } // four if(acc.Account_Manager__c == '0051I000002s0dpQAA') { acc.Onboarding_Specialist__c = '0051I000002QPrUQAW'; acc.Product_Specialist__c = '0051I0000027ODOQA2'; myList.add(acc); } // five if(acc.Account_Manager__c == '0051I000002QPrTQAW') { acc.Onboarding_Specialist__c = '0051I000002s0dqQAA'; acc.Product_Specialist__c = '0051I000002stE6QAI'; myList.add(acc); } } update myList; } }Any help appreciated!
Please check below post to learn about scheduler test class
1) http://amitsalesforce.blogspot.com/2017/07/how-to-write-test-class-for-scheduler.html
Try below test class.
Please post full error here with screen shot.
All Answers
Please check below post to learn about scheduler test class
1) http://amitsalesforce.blogspot.com/2017/07/how-to-write-test-class-for-scheduler.html
Try below test class.
Please post full error here with screen shot.