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
vivek singh 26vivek singh 26 

How we make calender in salesforce please help me

pradeep naredlapradeep naredla
Hi vivek,
  There is no need to prepare calender in salesforce if u select the field datatype as DATE then automatically the calender will populate when u click on the field.

Hi vivek ,
 i hop ethis will help you
 IF it really helpfull for u mark it as best answer .It will helpfull to others also.
vivek singh 26vivek singh 26
Sir, how we make through visualforce code please reply
Here you go:
vivek singh 26vivek singh 26
Hi sir
My  requirment is i want to  make a VF page and show calender in vf page  in want its code in salesforce how we make
thats exactly what I posted
vivek singh 26vivek singh 26
Sir i make trough code but error    
Error: Calendar line 107, column 13: XML document structures must start and end within the same entity
Error Error: XML document structures must start and end within the same entity.

 Please solve
VF page ------------------------------------------------------------------------------------

<apex:page controller="CalendarExample_Controller" action="{!pageLoad}">

    <link href="{!$Resource.fullCalendarCSS}" rel="stylesheet" />

    <link href="{!$Resource.fullCalendarPrintCSS}" rel="stylesheet" media="print" />


    <script src="//"></script>

    <script src="//"></script>

    <script src="{!$Resource.fullCalendarMinJS}"></script>



        //We need to wrap everything in a doc.ready function so that the code fires after the DOM is loaded

        $(document).ready(function() { 

            //Call the fullCallendar method. You can replace the '#calendar' with the ID of the dom element where you want the calendar to go.


                header: {

                    left: 'prev,next today',

                    center: 'title',

                    right: 'month,agendaWeek,agendaDay'


                editable: false,



                    //At run time, this APEX Repeat will reneder the array elements for the events array

                    <apex:repeat value="{!events}" var="e">


                            title: "{!e.title}",

                            start: '{!e.startString}',

                            end: '{!e.endString}',

                            url: '{!e.url}',

                            allDay: {!e.allDay},

                            className: '{!e.className}'










    <!--some styling. Modify this to fit your needs-->


        #cal-options {float:left;}

        #cal-legend { float:right;}

        #cal-legend ul {margin:0;padding:0;list-style:none;}

        #cal-legend ul li {margin:0;padding:5px;float:left;}

        #cal-legend ul li span {display:block; height:16px; width:16px; margin-right:4px; float:left; border-radius:4px;}

        #calendar {margin-top:20px;}

        #calendar a:hover {color:#fff !important;}


        .fc-event-inner {padding:3px;}

        .event-birthday {background:#56458c;border-color:#56458c;}

        .event-campaign {background:#cc9933;border-color:#cc9933;}

        .event-personal {background:#1797c0;border-color:#1797c0;}



public class CalendarExample_Controller {

    public Boolean includeMyEvents {get;set;}

    public list<calEvent> events {get;set;}


    //The calendar plugin is expecting dates is a certain format. We can use this string to get it formated correctly

    String dtFormat = 'EEE, d MMM yyyy HH:mm:ss z';



    public CalendarExample_Controller() {

        //Default showing my events to on

        includeMyEvents = true;



    public PageReference pageLoad() {

        events = new list<calEvent>();

        //Get Contact's Birthdays

        for(Contact cont : [select Id, Birthdate, FirstName, LastName from Contact where Birthdate != null]){

            //here we need to replace the birth year with the current year so that it will show up on this years calendar

            DateTime startDT = datetime.newInstance(Date.Today().Year(),cont.Birthdate.Month(), cont.Birthdate.Day());

            calEvent bday = new calEvent();


            bday.title = cont.FirstName + ' ' + cont.LastName + '\'s Birthday!';

            bday.allDay = true;

            bday.startString = startDT.format(dtFormat);

            //Because this is an all day event that only spans one day, we can leave the send date null

            bday.endString = '';

            bday.url = '/' + cont.Id;

            bday.className = 'event-birthday';




        //Get Campaigns

        for(Campaign camp : [select Id, Name, StartDate, EndDate from Campaign where IsActive = true]){

            DateTime startDT = camp.StartDate;

            DateTime endDT = camp.EndDate;

            calEvent campEvent = new calEvent();


            campEvent.title = camp.Name;

            campEvent.allDay = true;

            campEvent.startString = startDT.format(dtFormat);

            campEvent.endString = endDT.format(dtFormat);

            campEvent.url = '/' + camp.Id;

            campEvent.className = 'event-campaign';




        //Get my Events if we have selected the correct option


            for(Event evnt: [select Id, Subject, isAllDayEvent, StartDateTime, EndDateTime from Event where OwnerID = :UserInfo.getUserId()]){

                DateTime startDT = evnt.StartDateTime;

                DateTime endDT = evnt.EndDateTime;

                calEvent myEvent = new calEvent();


                myEvent.title = evnt.Subject;

                myEvent.allDay = evnt.isAllDayEvent;

                myEvent.startString = startDT.format(dtFormat);

                myEvent.endString = endDT.format(dtFormat);

                myEvent.url = '/' + evnt.Id;

                myEvent.className = 'event-personal';




        return null;



    public PageReference toggleMyEvents() {


            includeMyEvents = false;



            includeMyEvents = true;



        return null;



    //Class to hold calendar event data

    public class calEvent{

        public String title {get;set;}

        public Boolean allDay {get;set;}

        public String startString {get;private set;}

        public String endString {get;private set;}

        public String url {get;set;}

        public String className {get;set;}