You need to sign in to do that
Don't have an account?
LAL K 13
sObject type "OverallCompletionResult__c" is not supported
I have scheduled a scheduler from Installscript class.
My scheduler class is given below
Given below the OverallCompletionResultUpdation class
Please help me on this. Is this because of the sharing rules on scheduler?
Thanks for the help
global without sharing class InstallScript implements InstallHandler { global void onInstall(InstallContext context){ List<CronTrigger> ctList8 = [Select Id from CronTrigger where CronJobDetail.Name = 'OverallCompletionUpdate']; if(ctList8.size()==0){ String cronStr2 = '0 0 * * * ?'; OverallCompletionUpdateScheduler tl = new OverallCompletionUpdateScheduler(); String jobID = system.schedule('OverallCompletionUpdate', cronStr2, tl); } } }
My scheduler class is given below
global with sharing class OverallCompletionUpdateScheduler implements Schedulable { global void execute(SchedulableContext sc) { OverallCompletionResultUpdation ovr = new OverallCompletionResultUpdation(); ovr.process(); } }
Given below the OverallCompletionResultUpdation class
global with sharing class OverallCompletionResultUpdation{ global void process(){ //Initialize variables Map<Id,OverallCompletionResult__c> userMap = new Map<Id,OverallCompletionResult__c>(); Map<Id,OverallCompletionResult__c> contactMap = new Map<Id,OverallCompletionResult__c>(); List<User> userUpdateList = new List<User>(); List<Contact> contactUpdateList = new List<Contact>(); Map<Id,User> userIdMap = new Map<Id,User>(); Map<Id,Contact> contactIdMap = new Map<Id,Contact>(); //Fetch 2000 OverallCompletionResult records with isProcessed = false List<OverallCompletionResult__c> ovrList = [Select Id,ContactID__c,UserID__c,TotalCoursesAssigned__c,TotalCoursesCompleted__c,TotalLearningPathAssigned__c,TotalLearningPathsCompleted__c,OverallUserCourseCompletionPercentage__c,OverallUserLearningPathCompletionPercent__c From OverallCompletionResult__c Where isProcessed__c=false and ContactId__r.Deactivate_From_Litmos__c=:false limit 2000]; //Calculation logic goes here } }After installation when the sceduler runs It gives the above error "sObject type "OverallCompletionResult__c" is not supported" on the below line in the OverallCompletionResultUpdation class.
List<OverallCompletionResult__c> ovrList = [Select Id,ContactID__c,UserID__c,TotalCoursesAssigned__c,TotalCoursesCompleted__c,TotalLearningPathAssigned__c,TotalLearningPathsCompleted__c,OverallUserCourseCompletionPercentage__c,OverallUserLearningPathCompletionPercent__c From OverallCompletionResult__c Where isProcessed__c=false and ContactId__r.Deactivate_From_Litmos__c=:false limit 2000];
Please help me on this. Is this because of the sharing rules on scheduler?
Thanks for the help
Who ever is running this (in who's name is this scheduled), can you check if the user has View All access to OverallCompletionResult__c object?