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
Adriana VoyceAdriana Voyce 

Schedule Birthday Batch - Check Box

Hi All, 

I have a series of workflows with email alerts and filed updates for birthdays the details are here: https://help.salesforce.com/articleView?id=000181218&language=en_US&type=1 

The problem with this is that it requieres a mass update of all my records which puts thousands of records in time based workflow queue and interferes with other time based workflows that I have.

What I would like to do it the following: I have a formula that calculates "Next birthday Date" - I would like to have a scheduled batch that runs every night and for records that match that date - I want them to be checked with a checkbox that will kickoff the worklfows. I am using both regular contacts and person accounts so this needs to work on both or it has to be 2 different ones and thats ok, but I have NO IDEA!!! how to do something like this... Does any one know? 
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Adriana,
Global class HappyBirthday implements Schedulable{

global void execute(SchedulableContext sc) {

 List<user> lst=[Select id,name from user where date_of_birth__c =today];
   for(User u:lst){
FeedItem post = new FeedItem();

post.ParentId = u.id;

 post.Body = 'Happy birthday '+u.name;

   insert post;
}

} }

Please refer the below link for reference. Hope it will be helpful.

Please mark it as best answer if the information is informative.

Thanks
Rahul Kumar
Adriana VoyceAdriana Voyce
Hi @rahul thank you for answring but this class is looking at users, and its posting to a feed item... I know I can easily change the listy to Contacts and accounts, but would I set the update to something like contact.checbox__c =True? I need this to check a box on a nightly batch when the criteria is met