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
Bhargav SurapaneniBhargav Surapaneni 

Popup alert on team member birthday or anniversary

I want to create an popup alert on team members birthday/anniversary(birthday and anniversary are fields from user object). How to create such popup when we login. 

Thanks in Advance

Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Bhargav,

To Create an Automatic Birthday Email Please refer the salesforce help document. Hope it will be helpful.

Rahul Kumar
Hi Bhargav,

Birthday and anniversay are dates field from user object so for this first using soql query get the both field in one list in apex class.
Create one method and checked if the both field are same as the today date then create one alert message in the method.
Add the class in the vf page and no need to write any code in the vf page.
After that on Home Page Components create one visulaforce component and add that vf page in the component.
Add that component in the home page layout.
So after this when you will login in the org code check the date field and the today date and on the basis of vf page it will call action and show the alert popup or you can create popup in the vf page also.
This is the apporach please let me know if you need any other help.

Gyanender Singh
Shiva RajendranShiva Rajendran
Hi Bhargav,
If i had understood your question currently,then you want to open a popup when the current day is user's birthday on opening the vf page

Vf Page:
<apex:page controller="VfPageJsInitLoadingController" showHeader="false" sidebar="false" >
//html body onload function steps
    var previousOnload = window.onload;

    window.onload = function() 
        if (previousOnload) 
                { previousOnload(); } 
//birthday check from current date
    function birthdayWish()
        var todayDate =new Date();
        /*  todayDate.setMonth(7);
        var mDate=todayDate.getDate() + "-" +(todayDate.getMonth() +1) ;
                var theControllerValue = '{!userBirthdayString}';
               alert("its your birthday");
             alert("its not your birthday");
        //   alert(theControllerValue);

controller :
public class VfPageJsInitLoadingController {
    public Date userBirthday{get;set;}
    public String userBirthdayString{get;set;}
    public VfPageJsInitLoadingController()

     //getting the current user
        User muser=[select id,name,shivamindtree__birthday__c from user where id=:UserInfo.getUserId() ];
        System.debug(' ' +' '+muser.shivamindtree__birthday__c);
      userBirthday=  muser.shivamindtree__birthday__c;
       userBirthdayString= +'-'+ userBirthday.month();

For this code , you have to create a custom field called birthday on your user object.

Let me know if you need further help.
Thanks and Regards,
Shiva RV.