Quantcast
Channel: X-Squared On Demand »» Configuration
Viewing all articles
Browse latest Browse all 20

Next Birthday Formula

$
0
0

How would you display your Contacts with upcoming birthdays? I’ve seen people use “Birthdays This Week,” “Birthdays This and Next Week,” and other reports to display the list.

I’ve also seen requirements for showing a person’s next birthday, to trigger an automatic email to each Contact on his/her birthday. Let’s see how it’s done:

if(
Month (Birthdate) < = Month(Datevalue( NOW() ) ),
   if ( Month (Birthdate) < Month(Datevalue( NOW() ) ),
      DATE( YEAR( DATEVALUE( NOW() ) ) + 1 , MONTH( Birthdate ) , DAY( Birthdate ) ),
      if ( Day (Birthdate) < Day ( Datevalue ( NOW() ) ),
          DATE( YEAR( DATEVALUE( NOW() ) ) + 1 , MONTH( Birthdate ) , DAY( Birthdate ) ),
          DATE( YEAR( DATEVALUE( NOW() ) )  , MONTH( Birthdate ) , DAY( Birthdate ) )
      )
   ),
DATE( YEAR( DATEVALUE( NOW() ) ) , MONTH( Birthdate ) , DAY( Birthdate ) )
)

Next, use Batch Apex to send an email daily to all people where Next_Birthday__c == date.today(). Easy!

Now we can put this into a report and a dashboard showing the next “n” birthdays. Sure, it’s possible that more than n people will have a birthday on a given day, but at least you know that the emails will go out to each of them! If you want to see everyone with birthdays in a certain range, make a custom report and click through from a dashboard or a custom link.

Enjoy!


Viewing all articles
Browse latest Browse all 20

Trending Articles