function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tommie Thompson 24Tommie Thompson 24 

All steps needed to run an Apex Class to run the Chatter Daily Digest

Our Chatter Daily Digest stopped coming in October.  Salesforce has identified the bug and will have a patch in a couple of weeks.  In the meantime, they provided this Apex Class code to schedule the Chatter Daily Digest to be executed.

global class ChatterDigestScheduler implements Schedulable {
 global void execute(schedulableContext contest) {
   ConnectApi.Chatter.submitDigestJob(ConnectApi.DigestPeriod.DailyDigest);
     }
   }

I am not an Apex developer.  I am trying to figure out all of the steps to run this apex class on a daily schedule.  I have started by creating a the above class in our sandbox.  I put it in a change set to deploy in our production org, but I guess I am missing a test class that I don't know how to write!

I would really appreciate the steps I need to take to run this simple Apex Class.  Salesforce support said they cannot assist and directed me to this forum. 
VinayVinay (Salesforce Developers) 
Hi Tommie,

You can try below.
 
Class:
======
global class ChatterDigestScheduler implements Schedulable {
 global void execute(schedulableContext context) {
   ConnectApi.Chatter.submitDigestJob(ConnectApi.DigestPeriod.DailyDigest);
     }
   }

Test class:
===========
@isTest(SeeAllData=true)
public class ChatterDigestScheduler_Test {
static testMethod void test_ChatterDigestSchedule_Daily() {
ChatterDigestScheduler_Daily dailyProc = new ChatterDigestScheduler_Daily();
String schedStr = '0 0 23 * * ?';
Test.startTest();
System.schedule('TestCoverage - ChatterDigest Daily', schedStr, dailyProc);
Test.stopTest();
system.assert(dailyProc != null);
}
}

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,