From Faith Kindle: Generating an ICS file after Service Appointment Save in Salesforce Scheduler flows

Preface

Salesforce Scheduler provides tools needed to simplify appointment scheduling in Salesforce. With Salesforce Scheduler, it’s easy to embed appointment scheduling into standard Salesforce workflows, such as leads and referrals, opportunities, and accounts.

The outcome of the scheduling process is creation of a Service Appointment record which has the details of the appointment created by the Scheduler engine and informed by input from the end user. Salesforce Scheduler also includes out-of-the-box functionality that will generate a related event on the user’s (Service Resource’s) Salesforce calendar when ‘Event Management’ is enabled in Setup Salesforce Scheduler. Settings. Tools like Einstein Activity Capture can extend Scheduler’s “Event Management” functionality by synching these events to user’s calendar applications like Outlook, Google calendar, etc.

Problem Statement

While Einstein activity capture may be helpful for users using Salesforce, the question most implementation experts ask is – “How can we help prospects and customers scheduling externally to download the appointment confirmation to their personal calendars?”

An example can be with a new prospect interested to meet a financial advisor of a bank going ahead and scheduling an appointment using a contact us page from a company website (where the implementation done might be a guest flow exposed out on the company’s website) wants to download the appointment confirmation to their google calendar.

How do we solve for it?
The answer is with providing a ICS file – after the creation of a service appointment to download.

What is an ICS file?

Internet Engineering Task Force defined a standard in 1998 for sharing calendar events. An ICS file is a calendar file saved in a universal calendar format used by several email and calendar programs, including Microsoft Outlook, Google Calendar, etc. It allows users to share calendar information on the web and over email. Because all popular calendar applications can use ICS files to add event details to a calendar, ICS files are the most common type of files used to exchange calendar information.

ICS files are plain text files that contain information about a calendar event, including the event’s

  • Title
  • Summary and description
  • Start and end times
  • Location
  • Alert trigger

Creating ICS file in Salesforce

While we understand what goes into an ICS file, let’s look at some sample process to create one in Salesforce.

Making an ICS file available to download for Google Calendar, Microsoft Outlook, and Office 365

While there are several ways to make the ICS file available for download, we can make it EASY by making it available for download via link when (or after) we show the Appointment confirmation. In this example we will use flow to generate an ICS URL that, when clicked, will translate to an ICS file for Google Calendar, Microsoft Outlook, and Office 365. (Note: this is just one of many possible approaches. This approach can be be used in conjunction with Salesforce Scheduler’s out-of-the-box Inbound or Outbound new appointment flows, or your custom cloned versions of these flows.)

  • Create custom fields on the Service Appointment object with datatype as URL
    • In our example we created three URL fields with API names Google_ICS__c, Outlook_ICS__c, and Office_365_ICS__c
    • Note: this step is NOT necessary for displaying the URLs on your confirmation page, however may be useful later if, for example, you are sending a confirmation email to your customers and want to include the ability to download the appointment within that email.
  • On the Flow used for appointment booking
    • add Get Record action to retrieve the Service Appointment record after the Save Appointment action is executed
  • with a filter condition to retrieve the Service Appointment created in this flow
  • Add the following Formula variables to your flow. Note the reason for these different formulas is that each format we generate will expect slightly different syntax – for example, Google does not want hyphens or colons in its dates, and Microsoft uses “+” instead of spaces.
    • Note: you can modify these formulas to your business’s preferences, if they do not specifically match. For example, you may not want your subject to be “Service Appointment Subject with Service Resource first name.” In that case, you can remove the “with” and Service Resource first name from the formula to leave just the Service Appointment Subject, for example. Or, you are using a virtual web conference as your meeting place. In that case, you may want to input the web conference link in your description, or modify the text between the URLs’ location parameters in order to set the web conference as your location for your downloadable events.
    • StartDateFormatted
      LEFT(TEXT({!Get_SA.SchedStartTime}),4)+
      MID(TEXT({!Get_SA.SchedStartTime}),6,2)+
      MID(TEXT({!Get_SA.SchedStartTime}),9,2)+
      “T”+
      MID(TEXT({!Get_SA.SchedStartTime}),12,2)+
      MID(TEXT({!Get_SA.SchedStartTime}),15,2)+
      RIGHT(TEXT({!Get_SA.SchedStartTime}),3)
    • EndDateFormatted
      LEFT(TEXT({!Get_SA.SchedEndTime}),4)+
      MID(TEXT({!Get_SA.SchedEndTime}),6,2)+
      MID(TEXT({!Get_SA.SchedEndTime}),9,2)+
      “T”+
      MID(TEXT({!Get_SA.SchedEndTime}),12,2)+
      MID(TEXT({!Get_SA.SchedEndTime}),15,2)+
      RIGHT(TEXT({!Get_SA.SchedEndTime}),3)
    • GoogleICSURL
      https://calendar.google.com/calendar/r/eventedit?text=” & {!Get_SA.Subject} & ” with ” & {!Get_SA.Owner:User.FirstName} & “&details=” & {!Get_SA.Description} & “&location=” & {!Get_SA.Street} & “, ” & {!Get_SA.City} & “, ” & {!Get_SA.State} & “, ” & {!Get_SA.PostalCode} & “&dates=” & {!StartDateFormatted}&”/”&{!EndDateFormatted}
    • OutlookICSURL
      https://outlook.live.com/calendar/0/deeplink/compose?subject=” & {!Get_SA.Subject} & “+with+” & {!Get_SA.Owner:User.FirstName} & “&body=” & Substitute({!Get_SA.Description}, ” “, “+”) & “&location=” & Substitute({!Get_SA.Street}, ” “, “+”) & “+” & Substitute({!Get_SA.City}, ” “, “+”) & “+” & Substitute({!Get_SA.State}, ” “, “+”) & “+” & Substitute({!ServiceAppointment.PostalCode}, ” “, “+”) & “&startdt=” & Substitute(TEXT({!Get_SA.SchedStartTime}), ” “, “T”)& “&enddt=” & Substitute(TEXT({!Get_SA.SchedEndTime}), ” “, “T”)& “&allday=” & “false”
    • Office365URL
      https://outlook.office.com/calendar/0/deeplink/compose?subject=” & {!Get_SA.Subject} & “+with+” & {!Get_SA.Owner:User.FirstName} & “&body=” & Substitute({!Get_SA.Description}, ” “, “+”) & “&location=” & Substitute({!Get_SA.Street}, ” “, “+”) & “+” & Substitute({!Get_SA.City}, ” “, “+”) & “+” & Substitute({!Get_SA.State}, ” “, “+”) & “+” & Substitute({!Get_SA.PostalCode}, ” “, “+”) & “&startdt=” & Substitute(TEXT({!Get_SA.SchedStartTime}), ” “, “T”)& “&enddt=” & Substitute(TEXT({!Get_SA.SchedEndTime}), ” “, “T”)& “&allday=” & “false”
  • Add an Updates Records component to update your Service Appointment with the URLs you generated. Note: like the custom fields storing the URLs we generate, this step is NOT necessary for displaying the URLs on your confirmation page, however may be useful later if, for example, you are sending a confirmation email to your customers and want to include the ability to download the appointment within that email.
  • Display the URL fields on the confirmation page by dragging a Display Text component under the out-of-the-box Service Appointment Confirmation.
    • In the example below, we include a generic “Add to Calendar” graphic and hyperlinked text “Google | Outlook | Office 365.”
    • We use the hyperlink to link Google text to variable {!GoogleICSURL}
    • Similarly, Outlook text is linked to variable {!OutlookICSURL}
    • And Office 365 text is linked to variable {!Office365ICSURL}

Demo

Salesforce Scheduler Customization: Adding an ICS URL for a Clickable Link to Download Appointment

Resources