Single resource calendar parameters and embedding

In order keep configuration simple, please perform the following steps in Salesforce Classic (Booker25 is Lightning-Ready, you may afterwards use the app in Salesforce Lightning as you please)


When working with the Single Resource Calendar, you might want to link to a specific calendar directly, or embed a specific calendar into a custom page you created. This is possible using URL parameters with the Single Resource Calendar.

Single Resource Calendar page parameters

While the Start parameter does specify where the calendar starts, if the view being linked to is 'Week', 'WorkWeek' or 'Month', the page being displayed wil start at the start of the Week, WorkWeek or Month that Start is contained in.

Parameter NameRequired?Description
recordIdYesThe ID of the Resource, Staff or Group record you want to display the calendar for. This resource should exist, be Rentable and non Virtual
startNo

The Start date of the calendar. Should be in either the ISO 8601 format or the RFC 2822 format.

The time part is optional, but can be included to allow for easy use of DateTime fields. Special value TODAY will set Start to the current date of the computer looking at the calendar

viewNo

The unique name of a View that is attached to the calendar of the type of Resource being displayed. if the view could not be found, the default View wil be selected

calendarNoThe name of the calendar record where the configuration should be loaded from. When not specified the calendar of the dimension of the recordId is used, if this dimension has multiple calendars the one with the Default checkbox checked wil be used.
lightningNoIndicate if Booker25 is running in Lightning Experience context or not. Pass true if in Lightning Experience and false otherwise. This is required, because when Booker25 is embedded it has no way of detecting this context by itself. If not passed, Booker25 wil assume Classic context, and links to Visualforce pages wil not open correctly for users in Lighting Experience.

Single Resource calendar page structure and naming

The Single Resource Calendar consists of two separate pages:

Page namedescription
SingleResourceCalendarWrapperThe main page for the Single Resource Calendar. This page includes the Salesforce header and looks like a Salesforce page. Use this in your URL when linking to the calendar in both Salesforce Classic and Lightning.
SingleResourceCalendarThe page wrapped by B25__SingleResourceCalendarWrapper. This page contains all the actual logic for the Single Resource Calendar. Use this page when embedding the calendar in a detail page, or somewhere where the Salesforce header is already on the page.

Linking to a specific calendar

Lighting Considerations

When linking to the Single resource calendar from Lightning Experience, loading the page might result in the page opening without the Lightning header. When this happens append /one/one.app#/alohaRedirect to the front of the URL.

Doing this,

/B25__SingleResourceCalendarWrapper?recordId=XXXXXXXXXXXXXXXX

becomes

/one/one.app#/alohaRedirect/B25__SingleResourceCalendarWrapper?recordId=XXXXXXXXXXXXXXXX

You can link to a specific calendar by specifying the View and Start date in the URL. For example, to create a link to the calendar from a Reservation detail page that wil show the Single Resource Calendar on the week where the reservation starts proceed as follows:

  1. Go to the View record that specifies the week view on the Single Resource Calendar and copy the unique identifier, for example: SingleResourceCalendarWeekView
  2. Go to Salesforce Setup and create a new button or link on the Reservation object
  3. The URL to be used in this example would be
     /apex/B25__SingleResourceCalendarWrapper?recordId={!B25__Reservation__c.B25__ResourceId__c}&view=SingleResourceCalendarWeekView&start={!TEXT(B25__Reservation__c.B25__Start__c)}

  4. Save the new link and add it to the Reservation Page Layout
  5. The button / link should open the calendar on the week that the reservation starts, for the resource the reservation was made in.

Embedding the Single Resource Calendar in a Visualforce page

Booker25 includes three Visualforce pages that can be used to easily embed the single resource calendar on the detail pages of Resource, Staff and Group records: B25__ResourceDetailPageCalendarB25__StaffDetailPageCalendar and B25__GroupDetailPageCalendar.

These three pages can be added to the corresponding objects page layouts without any additional required work.

It is possible to embed the Single Resource Calendar into your own Visualforce pages and in the detail pages in the standard Salesforce ui.

In this example, we will show how to make a page that can be embedded into a Contact detail page. This Contact record has a lookup to the Staff record that represents this Contact, named Staff__c. This page will show the Contact's calendar for the current week.

ContactDetailCalendar visualforce page
<apex:page standardController="Contact">
	<style>
	 html, body, iframe {
		width: 100%;
		height: 100%;
		margin: 0px !important;
        padding: 0px !important;
  	}
	</style>
	<iframe frameborder="0" src="{!$Page.B25__SingleResourceCalendar + '?recordId=' + Contact.Staff__c + '&start=TODAY&view=SingleResourceCalendarWeekView'}" />
</apex:page>

Note how we used the B25__SingleResourceCalendar instead of B25__SingleResourceCalendarWrapper, to avoid the standard Salesforce header being shown within the Contact detail page. Also passing TODAY to the start parameter is optional, since when no parameter is passed it defaults to the current date.

Bookmarking calendars and linking calendars

This functionality only works in Salesforce Classic due to Salesforce limitations.

The Single Resource Calendar can be bookmarked and linked, as the app keeps the URL up to date with the current the View and Start parameters. This means that if you copy the current URL and distribute it to other users, they wil get the same calendar you are viewing (if they are logged in to Salesforce and their Permissions allow for this).

On this page