From Chris Albanese: Scheduler: Multi-Resource Scheduling – Default additional resource(s)
Introduction
Often times customers who use Multi-resource scheduling would like to default or automatically select the additional resource(s). For example, when scheduling a meeting with your portfolio advisor, you would like her assistant automatically added to every appointment and you want the available time slots to reflect this.
With a few simple flow configurations and a formula field, you can easily default the additional resource selection by setting a value for a variable called serviceResources. In the 2nd screen shot below, Russell was automatically selected because serviceResources had a value in it.

The variable called serviceResources is usually empty at this point. If you set a value for it, you can default the multi-resource selections.

Russell is pre-selected when entering this screen.
Video of it in action
Check out a quick demo video
Solution Overview
In this solution, a Service Resource can optionally have an Assistant Service Resource assigned to their record. If there is a value defined here, this Assistant SR will be defaulted as an additional required resource in the Multi Resource section of the time slot selection screen.
A few get records steps are added as well as a formula field to set the value for the serviceResources variable in the flow.
Object Model Changes
Add a new lookup field on the Service Resource object to itself. This field is called Assistant (Assistant__c). There are so many ways to tackle this, such as defining Primary and Secondary Resources on the Account object, or creating a junction object between Account and Service Resource or Service Resource and Service Resource to provide a more flexible design, as well as other designs. For simplicity sake, I added the lookup field on the Service Resource object to itself. In the second screenshot below, Connie has an assistant named Russell.


Flow Changes
Added Steps
If the selected Resource has an Assistant Service Resource, then using get Record steps, fetch the Resource’s record, related User Record and relevant Service Territory Member Record. For the Assistant Service Resource, fetch the same records.
Using a formula field, assign a value to the serviceResources variable.

Birds eye view – additional steps added after the candidate screen.

Zoomed in a little more – get SR, User and STM records for selected Candidate and Assistant. If the Assistant exists, use a formula field to set the value used by Multi-Resource Scheduling.
Formula field used in the set serviceResources assignment step
The formula is pretty simple – you just need to be particular with the open and closed quotes.

Let’s examine the elements in the formula
The variable called serviceResources is a JSON payload and for multi resource scheduling it contains 2 or more elements, with the first one being the primary resource and the second one (and possibly the third through fifth ones) being the additional resource(s). The bold text are comments I added for this blog and should not be in the formula you create.
‘[
{“UserPhoto”:”‘&{!get_Primary_User.FullPhotoUrl}&'”, Primary Resource Photo
“ServiceTerritoryMemberId”:”‘{!get_Primary_STM.Id}&'”, Primary Resource STM Id
“IsActive”:true, True
“ResourceType”:”‘&text({!get_Primary_SR.ResourceType})&'”, Primary Resource Type
“RelatedRecordId”:”‘&{!get_Primary_SR.RelatedRecordId}&'”, Primary Resource User Id
“Id”:”‘&{!get_Primary_SR.Id}&'”, Primary Resource Id
“Name”:”‘&{!get_Primary_SR.Name}&'”, Primary Resource Name
“sobjectType”:”ServiceResource”, Service Resource
“AttendanceType”:”Primary”}, Primary
{“UserPhoto”:”‘&{!get_Assistant_User.FullPhotoUrl}&'”, Assistant Resource Photo
“ServiceTerritoryMemberId”:”‘&{!get_Assistant_STM.Id}&'”, Assistant Resource STM Id
“IsActive”:true, True
“ResourceType”:”‘&text({!get_Assistant.ResourceType})&'”, Assistant Resource Type
“RelatedRecordId”:”‘&{!get_Assistant.RelatedRecordId}&'”, Assistant Resource User Id
“Id”:”‘&{!get_Assistant.Id}&'”, Assistant Resource Id
“Name”:”‘&{!get_Assistant.Name}&'”, Assistant Resource Name
“sobjectType”:”ServiceResource”, Service Resource
“AttendanceType”:”Required”} Required
]’
Notes about the formula
- If you use AttendanceType = Required, the additional resource’s availability is reflected in the time slots. If you make it “Optional”, then only the primary resource’s availability is reflected.
- If you have additional resources, just add additional elements for them in the formula, modeled after the Assistant Resource. You may choose to do this in a loop to provide some flexibility
- If you use Asset Service Resources, then there will be no photo
- If you want to mandate that there is at least 1 secondary resource, you can test in a decision element that serviceResources contains either the word “Required” or “Optional” and redirect the user back to this screen if this is not true
Here’s the uncommented formula
‘[{“UserPhoto”:”‘&{!get_Primary_User.FullPhotoUrl}&'”,”ServiceTerritoryMemberId”:”‘&{!get_Primary_STM.Id}&'”,”IsActive”:true,”ResourceType”:”‘&text({!get_Primary_SR.ResourceType})&'”,”RelatedRecordId”:”‘&{!get_Primary_SR.RelatedRecordId}&'”,”Id”:”‘&{!get_Primary_SR.Id}&'”,”Name”:”‘&{!get_Primary_SR.Name}&'”,”sobjectType”:”ServiceResource”,”AttendanceType”:”Primary”},{“UserPhoto”:”‘&{!get_Assistant_User.FullPhotoUrl}&'”,”ServiceTerritoryMemberId”:”‘&{!get_Assistant_STM.Id}&'”,”IsActive”:true,”ResourceType”:”T”,”RelatedRecordId”:”‘&{!get_Assistant.RelatedRecordId}&'”,”Id”:”‘&{!get_Assistant.Id}&'”,”Name”:”‘&{!get_Assistant.Name}&'”,”sobjectType”:”ServiceResource”,”AttendanceType”:”Required”}]’
Note: Make sure you have enabled the feature
