• LAL K 13
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
I need to track the email change for Standard platform user and do some logic. But This is not happening as email change is not invoking user trigger. Is this a known issue or is there any way to get the changed email in Trigger?
I have scheduled a scheduler from Installscript class. 
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
I need to track the email change for Standard platform user and do some logic. But This is not happening as email change is not invoking user trigger. Is this a known issue or is there any way to get the changed email in Trigger?
I have scheduled a scheduler from Installscript class. 
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