From Sunil Nandipati: Scheduling a Contact

Problem Statement

With Salesforce Scheduler, it’s easy to embed appointment scheduling into standard Salesforce workflows, such as leads and referrals, opportunities, accounts (and person accounts in the B2C Model).

But NOT for Contacts (with B2B model) and Cases.

Though it is synonymous that you want to schedule a Contact when we say scheduling around a case, since the case contact is the person you would prefer interacting with, we will look at options to schedule a contact.

Note: Field Service Lightning Product extends this to additional objects – Work Order, Work Order Line Item and Asset.

Understand Scheduler OOTB Behavior

Before we start looking at an option how we can customize the experience for scheduling around a contact, lets try to understand the core objects we have from Salesforce Scheduler that capture a booked appointment using the OOTB behavior and how we can reuse the existing OOTB available references.

  • Service Appointment
  • Assigned Resources
  • Event

We will keep our focus understanding the relationships and the references

ObjectFieldData TypeUsage
Service AppointmentParentRecordLookup(Account,Opportunity,Lead)Using Salesforce Scheduler we can create a Service Appointment only around Account, Opportunity or Lead.
Service AppointmentAccountLookup(Account)Defaults to the Customer account’s for inbound, Left blank for a Lead and related account if booking around an opportunity.
Service AppointmentContactLookup(Contact)Defaults to the user’s contact record when requesting from a customer community via an inbound authenticated user booking scenario. Left blank otherwise.

We will use this standard field to Stamp the Contact ID – during Service Appointment creation when doing an Outbound Scheduling from Internal Salesforce in this blog.
Assigned ResourceServiceAppointmentMaster-Detail(Service Appointment)Service Appointment object does NOT hold the service resource information, it is primarly stored in the Assigned Resource object. This is the reference to Service Appointment.
Assigned ResourceServiceResourceLookup(Service Resource)Service Resource reference (can be either a user or an asset)
Service ResourceRelatedRecordLookup(User)Service resource object reference to a User – which can be either a Platform Starter / Partner Community / Customer Community Plus / Salesforce license type user
EventWhoIdLookup(Contact,Lead)Events are like your calendar events. The person who will attend this event is captured here.
EventWhatId (Related To)Except Lead and Contact, Other objectsAnd this event is related to what in Salesforce
EventServiceAppointmentLookup(Service Appointment)When Event Management is turned ON on the Scheduler settings, every time a service appointment is created, it creates a related Event – this is to hold that references
EventOwner (Assigned To)Lookup(User,Calendar)Represents the owner of the record (internal user or an external calendar)

Customization Guidance to schedule a Contact

Having looked at the above objects and references, it is pretty much clear that we CAN reuse the existing Contact lookup on Service Appointment. When using Events, we WILL have to make sure the related EVENT gets created with this Contact reference as well.

To achieve this we need to modify the existing template slightly. Try these steps outlined below

  1. Start with a cloned flow from the template (In this example we have cloned the “Outbound New Appointment” template to create a flow called “Outbound New Appointment for Contact”)
  2. Since we plan to launch this from a Contact record, the recordId will be the Contact.Id that will be passed to the Flow. So we need to make sure we capture the Contact.AccountId as well. Create a variable to capture the AccountId. Service Appointment ParentID field can only accept records from Lead, Account and Opportunity, so lets make sure we pass the account information from the Contact
  • Assignment – Set Initial Values :: make sure the recordId is assigned to ServiceAppointment.ContactId
  • Screen – Attendees Screen :: ensure the Contact ID assignment is NOT empty – change it to {!ServiceAppointment.ContactId}
  • Screen – Review Screen :: ensure the Contact ID and Parent Record ID assignments are correct
  • Finally make sure the Event Management is turned ON
  1. Save the Flow and Activate it
  2. Add a Lightning Action to Launch this flow
  • Add this Lighting Action to your Contact Page Layout
  • Finally, test it for yourself. Here is a demo of the same configuration tested on a developer trial org

Considerations when using with Field Service

As mentioned in the preface – Scheduling an appointment gets extended to additional Objects which are NOT supported by Salesforce Scheduler when using Salesforce Field Service product (Earlier Field Service Lightning).

Some considerations to keep in mind when using both products – https://help.salesforce.com/s/articleView?id=sf.ls_limitations.htm&type=5

Especially with both the products (Scheduler and Field Service) in the same org, ensure you take extra care around Event Management using a custom route rather than turning ON the Event Management option as mentioned above.