Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Set Up Calendar Integration

Learning Objectives

After completing this unit, you’ll be able to:

  • Sync Salesforce calendar with external calendars.
  • Write Salesforce appointments to external calendars using platform events.

Calendar Integration

It’s a sunny day in Pennsylvania, and Ryan Dobson, a financial advisor at Cumulus Cloud Bank, is having some quality time with his daughter. They’re barbecuing lunch in their backyard. “It’s all about getting the timing right for that perfect steak,” he tells her. As he turns his wrist to check the time, he realizes that he has an online appointment with a client in the next 3 minutes! Although Ryan knew about the appointment, he lost track of time and his phone’s calendar didn’t have the meeting saved.

Ryan realizes that he’s not alone. Cumulus Cloud employees (and even customers) want to have the appointments synced to the external calendar apps that they use, such as Microsoft Outlook and Google Calendar. They also don’t want meetings, training, and other events on their external calendars to have a scheduling conflict with Salesforce Scheduler appointments. 

Ryan contacts the admin, Matt, to see if he can do something to help overcome these challenges.

Matt starts exploring the possibilities and recognizes that there are several ways to set up calendar integration.

  • Sync Salesforce Calendar and external calendars using calendar sync tools such as Einstein Activity Capture.
  • Write Salesforce Scheduler appointments to external calendars using platform events and APIs. This method requires Salesforce programming expertise and is ideal if he wants to exercise greater control over the entire process.

Matt also learns that he can configure scheduling policy rules to check calendars to determine availability.

Let’s follow along as Matt explores the various methods of calendars integration and configuring scheduling policy rules. Depending on your need, you can choose how to integrate calendars and configure scheduling policy rules.

Sync Salesforce Calendar and External Calendars Using Calendar Sync Tools

Show Service Appointments as Events on Salesforce Calendar

Before Matt can use a calendar sync tool to write Salesforce appointments to external calendars, he enables event management to write Salesforce Scheduler appointments as events on the Salesforce calendar.

  1. From Setup, in the Quick Find box, enter Salesforce Scheduler, then select Salesforce Scheduler Settings.
  2. Enable Event Management.

With Event Management enabled, service resources can see their scheduled appointments as events on their Salesforce calendar. When there are changes to service appointments, Salesforce Scheduler automatically updates the corresponding event on the Salesforce calendar.

To learn how fields on the Event object map to the fields on the Service Appointment or Assigned Resource objects, see Write Salesforce Scheduler Appointments to Salesforce Calendar.

Some things to note when you enable event management:

  • To use Event Management in an Experience Cloud site, you need the Customer Community Plus or Partner Community license.
  • Salesforce Scheduler creates a Salesforce calendar event for an appointment only when the appointment has a scheduled start time and an end time.
  • To update the start or end time of an event, update the appointment in Salesforce Scheduler. Don’t edit the event directly on the Salesforce calendar or external calendars. If you cancel an appointment or update it to remove the scheduled start and end time, the corresponding event is deleted from the Salesforce calendar.
  • Any assets such as rooms or equipment that are booked in an appointment don’t create calendar events.
  • When users create appointments in Salesforce Scheduler, they’re view-only on the Salesforce calendar.

Sync Salesforce Calendar with External Calendars Using Einstein Activity Capture

To sync the Salesforce calendar with an external calendar such as Microsoft Outlook, Matt evaluates multiple tools and, after carefully going through Einstein Activity Capture Considerations, he chooses Einstein Activity Capture.

Here’s a table that shows the different sync directions, the expected behavior, and where users must edit events, which aren’t related to service appointments, based on the sync direction.

Sync Direction Expected Behavior Where to Edit Events

Salesforce to external calendar

All the events on Salesforce calendar are synced to external calendars.

When Event Management is enabled, Salesforce Scheduler writes appointments as events on the Salesforce calendar and syncs them to external calendars. For example, when a customer books an appointment with a service resource using Salesforce Scheduler, the appointment appears on Salesforce calendar and external calendars.

Events created or edited directly on external calendars don’t appear on or sync to Salesforce calendar.

Salesforce Scheduler

External calendar to Salesforce

Events created or edited directly on external calendars appear on and sync to the Salesforce calendar.

Events on Salesforce calendar, including service appointments created or edited in Salesforce Scheduler, don’t sync to external calendars.

External calendar

Bidirectional (Commonly used with Salesforce Scheduler)

All the events on Salesforce calendar are synced to external calendars.

When Event Management is enabled, Salesforce Scheduler writes appointments as events on the Salesforce calendar and syncs them to external calendars.

Events created or edited directly on external calendars appear on and sync to Salesforce calendar.

Salesforce Scheduler or External Calendar

Based on the sync direction, Matt informs users where to edit the events. He also informs users that they must modify or cancel Salesforce Scheduler appointments in Salesforce Scheduler. If users modify or cancel those service appointment events directly on external calendars, the events can be out of sync with the Salesforce Scheduler and Salesforce calendar.

Here’s an illustration of data flow when event management is enabled and the sync direction is set from Salesforce Scheduler to an external calendar.

An illustration of flow of data from Salesforce Scheduler to external calendars.

When a service appointment gets created, updated, or deleted, Salesforce Scheduler writes it to the Salesforce calendar. Calendar sync tool then asynchronously passes the appointments to a client exchange server such as Outlook. 

To learn how fields from your Salesforce events are mapped to fields in the connected Microsoft or Google account, see Field Mappings for Event Sync.

Write Salesforce Scheduler Appointments to External Calendars using Platform Events

Matt can use Einstein Activity Capture and set the sync direction from Salesforce to external calendar to write Salesforce Calendar events to external calendars. However, if he wants greater control over the sync process, Matt must publish service appointments as platform events, use event listeners to subscribe to the platform events, and use API classes to update external calendars. Let’s follow along as Matt explores this approach.

Matt configures settings such that Salesforce Scheduler triggers platform events when appointments are created, updated, or deleted.

  1. From Setup, enter Salesforce Scheduler in the Quick Find box, then select Salesforce Scheduler Settings.
  2. Enable Publish Appointments as Platform Events.

The Salesforce Scheduler Settings page.

Some things to note when you enable the Publish Appointments as Platform Events setting:

  • Salesforce Scheduler doesn’t generate platform events for time blocked for before and after appointment buffers. Instead, Salesforce Scheduler adds these buffer-related Salesforce Calendar events to the appointment event payload.
  • When multi-resource scheduling is enabled, only one platform event is generated even if an appointment has multiple attendees.

Matt teams up with the bank’s in-house developer, Ancelot Mark Pinto, for the next step. Together, they use the Subscribing to Platform Events Developer Guide to subscribe to the AppointmentSchedulingEvent platform event with Apex triggers. 

Note

As an alternative to Apex triggers, use an EMP Connector, a CometD client, or a third-party connector such as the Salesforce Platform Events Source Connector for Confluent Platform.

The last step is to implement APIs to write the platform event changes to the external email server. Since Ryan and most of the bank’s employees use Outlook, Matt uses the Microsoft Graph REST API to publish the events to Outlook.

Here’s an illustration of how it works. When a service appointment gets created, updated, or deleted, it triggers a platform event, which then gets published to the external calendar via Apex triggers or Streaming API(CometD).

An illustration of data flow from Salesforce Scheduler to external mail server through platform events.

Matt now knows how to integrate calendars and the considerations for different types of integration. In the next unit, Matt explores how to configure Salesforce Scheduler to check Salesforce calendar and external calendars to determine availability. Then, he’ll choose the approach to integrate calendars and check calendars to determine availability that meets all their requirements.

Resources

在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈