Learning Salesforce Visual Workflow and Process Builder(Second Edition)
上QQ阅读APP看书,第一时间看更新

Solution 1 - using Apex

We can't achieve this goal by the Workflow rule. For this, we have to write an Apex class that implements the Schedulable interface for the class and then use Schedule Apex to run it on a regular basis. The following is the code for this Apex class:

global class SendChatterEmail implements Schedulable 
{
global SendChatterEmail (){
// Batch Constructor
}

// Start Method
global Database.QueryLocator start(){
/* Use SOQL query to get the records you want to operate upon
select Id, fullPhotoUrl from User where isactive = true AND FullPhotoUrl like '%photo/005%'*/
}

// Execute Logic
global void execute(){
// perform the operation

}

global void finish(){
// Logic which we want to execute at finish
}
}