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
AMSAMS 

Next birthday formula field

I'm trying to implement an "upcoming birthdays" report as described here:

http://blogs.salesforce.com/analytics/2007/12/if-youre-like-m.html

except that

1. the images in that blog post are broken, and
2. i don't want to install the entire appexchange package (9 components) when all I really need to see is the formula field definition for "Next Birthday."

Anyone have this package installed already and willing to share the formula? Thanks!

Aaron
HerosHeros
I can see the images so I just copied the formals.  I have not downloaded the application though because it is too big. But if you want the application I suggest getting a Developers login (they are free) and try downloading it into that.

This formula takes the birthdate, and, if the date this year has already gone by, it gives it next year's year number, or it sets the next birthday as the day and month of the birthdate, with this year...

DATE(IF(TODAY()<date(year(today()),month(Birthdate),DAY(Birthdate)),YEAR(TODAY()),YEAR(TODAY())+1),month(Birthdate),
DAY(Birthdate))



Next is a simple one that looks at age. This just looks at the years between the birthdate and the next birthday:

YEAR( tobinators__Next_Birthday__c) - YEAR(Birthdate)
KrawlsKrawls
Hello-

I just installed the package it seemed to be working great, and then I clicked to view the report as I added some fields to it and wanted to see the updates and I recieved the following error:

Computed an invalid date, such as February 29th on a non-leap year. Please contact your administrator; formula fields can cause such errors.

What do I do to fix the error?  I am very new to SFDC especially the formula side of things, and am clueless as what to do to make this work...

thanks,

PeanutmanPeanutman

What this error means is your custom formula field is creating an invalid date.

Suppose someone puts in a date of 2/29/2008. The formula you have will make the next birthday 2/29/2009 which is invalid.

You should check out this thread I started about calculating the birthday for the next year:

http://community.salesforce.com/sforce/board/message?board.id=discuss&message.id=3460

In order to avoid the 'bad birthday', I have a validation rule which says if the day is 29 and the month is 2, force the user to put in 2/28 or 3/1.

Good Luck!

Eric

KrawlsKrawls
Thank you for your help!

I reviewed the your suggested thread great information - hopefully I will understand workflows better soon and i can implement that in our system.

Can you potentially give me an example of what the validation rule would look like?  I dont even know where to start on that.  I am a very new user.

I assume the validation rule would be for "Birthdate" i just dont know what it should look like.

Thanks,

PeanutmanPeanutman

Hi!

Here is the validation rule I used:

AND (DAY(Birthdate)=29,MONTH(Birthdate)=2)

This prevents users from putting in a leap year birthday.

Good Luck!

Eric

 

Ramakrishnan AyyanarRamakrishnan Ayyanar
Problems:

1)If DOB is Feb 29 Leap year.How to find next birthday for that particular date?

No Need Validation rule for this code.

End-of-century years 1700, 1800,1900,2100 these years are not leap year in these problems are resolved.........

To find the next Birthday formula

How to create......

step-1: create the custom field for Date of Birth----It's type-Date

step-2: create the formula field for Birthday ---It's type-Date

code:

iIF ( MONTH (ramki__DOB__c)=2 && DAY (ramki__DOB__c)=29,
DATE(
IF(Year(Today())<=Year(ramki__DOB__c),Year(ramki__DOB__c),
IF(
OR(MOD(Year(Today())+ 4-MOD(Year(Today()),4),400)=0,
AND(MOD(Year(Today())+ 4-MOD(Year(Today()),4),4)=0,
MOD(Year(Today())+ 4-MOD(Year(Today()),4),100)<>0)),
Year(Today())+ 4-MOD(Year(Today()),4),
Year(Today())+ 8-MOD(Year(Today()),4))
),
MONTH(ramki__DOB__c),DAY(ramki__DOB__c)),
IF (DATE (YEAR(TODAY()),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)) > TODAY(),
DATE (YEAR(TODAY()),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)),
DATE (YEAR(TODAY())+1,MONTH(ramki__DOB__c),DAY(ramki__DOB__c))
)
)

it's correctly worked for leap year dates.......
this is code for find the next Birthday friends......


Easily Calculate Age:

create formula field -------(Number)

Age=YEAR( ramki__BirthDay__c) - YEAR(ramki__DOB__c)
----
softramki@gmail.com
+919944112175