Skip to main content
Join the Agentforce Hackathon on Nov. 18-19 to compete for a $20,000 Grand Prize. Sign up now. Terms apply.

Enable Recurrence and Multiple Topics

Learning Objectives

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

  • Enable users to create recurring shifts.
  • Set up multiple topics for shifts.
  • Create a recurring shift with multiple topics.

Recurring Shifts

It’s been a few weeks since the implementation of flexible shifts. Branch managers, employees, and contractors understand that there are patterns to their working hours. For example, Arun works from 11:00 AM to 7:00 PM on Wednesdays and from 8:00 AM to 4:00 PM on the remaining weekdays.

Wouldn’t it be great if the team could specify availability for multiple days in one go instead of using individual shift records? Well, that’s possible.

Users can create recurring shifts to specify working hours that repeat at regular intervals. And after you set up an approval process, branch managers can approve the entire series with a single click. For more information, see Approval Process in Salesforce Scheduler.

To create a recurring shift, on the New Shift page, enter the details, select Recurring as the Type, and enter the recurrence pattern details.

The Type field and the recurrence pattern details on the New Shift page.

For the Cumulus Bank team to create recurring shifts, Matt must make a small change in the org.

Enable Users to Create Recurring Shifts

In orgs created after the Winter ’23 release, the Type field is available on ‘Shift Layout’ of the Shift object by default. Because Cumulus Bank started using shifts before the Winter ’23 release, Matt must add the Type field to Shift Layout.

Here’s how he does that.

  1. Click Setup, and then select Setup.
  2. Click Object Manager.
  3. Click Shift.
  4. Click Page Layouts.
  5. Click Shift Layout.
  6. In the palette, click Fields.
  7. Drag Section to the Shift Detail section and add it below the Information section.
  8. In the Section Properties window, enter these details.
    • Name: Recurrence Details
    • Display Section Header On: Deselect Detail Page and Edit Page
    • Layout: 1-Column
      The Section Properties dialog box.
  9. Click OK.
  10. Drag the Type field to the Recurrence Details section.
    The Recurrence Details section shows the Type Field.
  11. Click Save.

Similarly, in orgs created after the Winter ’24 release, the Recurrence Pattern field is available on ‘Shift Layout’ of the Shift object by default. Therefore, Matt must also add the Recurrence Pattern field to Shift Layout.

Here’s how he does that.

  1. Click Setup, and then select Setup.
  2. Click Object Manager.
  3. Click Shift.
  4. Click Page Layouts.
  5. Click Shift Layout.
  6. In the palette, click Fields.
  7. Drag Recurrence Pattern to the Shift Detail section and add it under the Recurrence Details section.
    The Recurrence Details section shows the Recurrence Pattern Field.
  8. Click Save.

Multiple Topics for Shifts

Bankers are more motivated than ever and are diversifying their skill sets. Arun, the pro retail banker, has completed the certifications required to support wealth management and loan appointments.

Though he’s proficient at handling three work type groups, there are cases where he handles a subset of these work type groups. For example, he only handles retail banking and wealth management appointments during certain shifts. In such cases, he must create two shift records: one for retail banking and another for wealth management, with the remaining details being the same.

Well, Arun isn’t alone. Fola knows that many bankers face the same challenge, and asks Matt if it’s possible for users to add multiple topics to shifts. Matt tells her that it’s possible, thanks to the Multiple Topics for Shifts setting.

Migrate Work Type Group Data

By default, Salesforce Scheduler uses shift records to manage topic information. When you enable the Multiple Topics for Shifts setting, Salesforce Scheduler uses the Shift Work Topic junction object to manage the topics supported by shifts. Shift Work Topic represents the relationship between a Shift object and a Work Type or Work Type Group object for Salesforce Scheduler.

So before Matt enables the setting, he must:

  1. Migrate topic data from shift records to shift work topic records.
  2. Delete the topic data from shift records.

Here’s how Matt migrates topic data from shift records to shift work topic records.

  1. Click Setup, and then click Developer Console.
  2. Click Debug, and then select Open Execute Anonymous Window.

Enter this code.

Integer countOfShifts = [SELECT COUNT() FROM Shift];


//If shift records are more than 50,000
for(Integer i=0; i>=0; i=countOfShifts-50000) {
    List<ShiftWorkTopic> shiftWorkTopics = new List<ShiftWorkTopic>();
    for(Shift shiftRecord : [Select Id, WorkTypeGroupId From Shift Where Id NOT IN (SELECT ShiftId FROM ShiftWorkTopic) LIMIT 50000]){
        ShiftWorkTopic swtRecord = new ShiftWorkTopic();
        swtRecord.ShiftId = shiftRecord.Id;
        if(shiftRecord.WorkTypeGroupId == null){
            swtRecord.AreAllTopicsSupported  = true;
        } else {
            swtRecord.WorkTypeGroupId = shiftRecord.WorkTypeGroupId;
        }
        shiftWorkTopics.add(swtRecord);
    }
    insert shiftWorkTopics;
}
  1. Click Execute.

To delete the topic data from shift records, Matt repeats the steps to run the following code.

Integer countOfShifts = [SELECT COUNT() FROM Shift];


//If shift records are more than 50,000
for(Integer i=0; i>=0; i=countOfShifts-50000) {
    List<Shift> shiftRecords = new List<Shift>();
    for(Shift shiftRecord : [Select Id, WorkTypeId, WorkTypeGroupId From Shift Where WorkTypeId != null OR WorkTypeGroupId != null LIMIT 50000]){
        Shift shift = new Shift();
        shift.Id = shiftRecord.Id;
        shift.WorkTypeId = null;
        shift.WorkTypeGroupId = null;
        shiftRecords.add(shift);
    }
    update shiftRecords;
}

Enable Multiple Topics for Shifts

After migrating the data, here’s how Matt enables the Multiple Topics for Shifts setting.

  1. Click Setup, and then click Setup.
  2. In the Quick Find box, enter Scheduler Settings, and then click Salesforce Scheduler Settings.
  3. Enable Multiple Topics for Shifts.

Assign Skills

Because Arun supports wealth management and loan appointments, Fola assigns the Wealth Manager skill to him.

  1. Click App Launcher to open the App Launcher.
  2. Select Service Resources.
  3. Click Arun Sanghi.
  4. Click Related.
  5. In the Service Resource Skills section, click Assign Skills.
  6. Select Wealth Manager, and then click Next.
  7. Provide these details.
    • Skill Level: 80
    • Start Date: Current Date
  8. Click Save.
  9. Repeat steps 5–8 to assign the Loan Officer skill with 9 as the skill level.

Fola notifies all the bankers that they can now create recurring shifts and add multiple topics to shifts.

Create a Recurring Shift with Multiple Topics

The notification couldn’t have come at a better time for Arun: He’s about to create shifts for the next few weeks. He can use both the features to easily specify his availability.

Here’s how Arun creates a recurring shift.

  1. Click App Launcher to open the App Launcher.
  2. Select Shifts.
  3. Click New.
  4. Provide these details.
    • Start Time: 8:00 AM on the Monday after next. For example, if you’re creating the shift on 1-June-2023, select 12-June-2023.
    • End Time: 4:00 PM on the Monday after next
    • Status: Confirmed
    • Service Resource: Arun Sanghi
    • Service Territory: Headquarters
    • Time Slot Type: Normal
      The New Shift window with shift details entered.
    • Type: Recurring
    • Recurrence Pattern: Weekly
    • Repeat Every: 1 week
    • Repeats On: Mon, Tue, Thu, and Fri
    • Number of Occurrences: 12
      The New Shift window with the recurrence pattern details.
  5. Click Save.

With the recurring shift in place, Arun adds Retail Banking and Wealth Management topics to it.

  1. Click App Launcher to open the App Launcher.
  2. Select Shifts.
  3. Click the recurring shift record.
  4. Click The show more actions button, and then click Add topics. The Add topics window appears.
  5. In the Topic field, enter Retail Banking, and then click Retail Banking.
  6. In the Topic field, enter Wealth Management, and then click Wealth Management.
    The Add topics window.
  7. Click Save.

He repeats the steps to specify his availability for Wednesdays from 11:00 AM to 7:00 PM.

Greater Ease

Bankers and branch managers are pleased that they can now create recurring shifts and add multiple topics to shifts. With fewer manual tasks on their hands, bankers continue to focus on what they do best—help customers!

In the next unit, follow along as Matt and Fola hide service territory operating hours and explore the shift schedule view.

Resources

Salesforce ヘルプで Trailhead のフィードバックを共有してください。

Trailhead についての感想をお聞かせください。[Salesforce ヘルプ] サイトから新しいフィードバックフォームにいつでもアクセスできるようになりました。

詳細はこちら フィードバックの共有に進む