Mapping the Resource Field in Salesforce

Overview

Resource scheduling is one of DayBack real strengths. For an introduction to resource scheduling views, check out: Resource Scheduling.

When setting up your calendar, you'll need to specify which field holds your resource data. This article explains the types of fields you can use for resources.


What is a Resource?

A "resource" is anything that can be overscheduled in your organization: a room, a person, a team, or even a business process. Resource views provide a dedicated row or column for each resource, making it easy to see which are overscheduled, and which have gaps, and to drag events from one resource to another.

In field mapping, you'll select the field in your event or appointment object that contains your resource. For example, in the native Event object, the resource is usually a person, and the field is typically Owner.Name . In a custom object, you may have created a field for the truck or technician that serves as your resource.

The rest of this article details the types of fields you can use for resources on the "Resources" tab of your field mapping configuration. Each type has its own advantages and disadvantages.

Note: In addition to field mapping, you will also add resources to DayBack's left-hand sidebar to filter the calendar by resource and group your resources into folders by skill or location. For more information, see: Adding, Removing, and Sorting Resources.


Owner.Name - The default for Events, Tasks, and Campaigns

By default, DayBack maps resources to the Owner.Name field in your Event and Task objects. This setup works well for many applications. To use Owner.Name , leave the switch for "My Resource is a Related Field" set to "no" and select Owner.Name from the dropdown list of available fields when mapping your resource.

Please Note: DayBack will clear out your resource selection whenever you toggle the switch for "My Resource is a Related Field," so double-check any previous selection for the resource field before making this change.

Downsides of using Owner.Name, or the native Event Object:

  • Single Value Limitation
    • Salesforce does not allow multiple values for the Owner.Name field.
  • Mandatory Assignment:
    • You cannot leave the owner field blank or drag an event to the "none" column in DayBack to temporarily unassign the event.

To address these limitations, you can create multiple instances of the same event by control-dragging or option-dragging an event to a new resource to quickly create a duplicate copy of the event.

Alternatively, you can use the multi-select picklist strategy below, or explore other strategies mentioned in our article on Multiple Resources Per Object.


Text fields and Multi-selection Picklists - Supporting Multiple values 

You can map the resource field to a long text field or a multi-selection picklist. This most flexible option allows multiple resources for the same event without triggers or other customizations, making it ideal for testing a new calendar in DayBack.

For text fields, leave the switch for "My Resource is a Related Field" set to "no."


Service Appointments

For the Service Appointment object, DayBack sets a slightly different switch the "My Resource is a Related Field" switch to "yes" by default when you first install DayBack. Contact support if you need to change this setting due to using Resources or Assets in an unusual way.


If your resource is a related record, set the "My Resource is a Related Field" switch to "yes," revealing additional options.

Displaying Resources

The following options let you describe the relationship you'd like to use for your resource. In the example above, our appointment is related to a custom object for our Contractor
  • Resource ID Field Name:
    • You will see a list of relationship IDs. Select the relationship ID from your appointments object. If no ID is listed, it means there is no relationship between the calendar's object and the target object.
  • Resource Name Field:
    • DayBack fills in the Name field of your object by default, but you can select another field. For example, you might use a formula field that combines the contractor's name and specialty. You could show this combined name instead of the contractor's name. Note that if you change or create fields in other Salesforce screens while you have this field mapping screen open, you can click the button "Refresh Drop-Down Options" at the top of the screen to get access to newly created fields.
  • Label:
    • Enter the text to display to the left of the resource name in DayBack's popover when clicking on an event.

Searching for and Selecting Resources

Scroll down in the resources tab to find the "Searching for and Selecting Resources" section. This is automatically completed when you select a Resource ID Field Name above.

Customizing the Search and Display Fields

You might only need to adjust the "search field" and "display field" settings. Leave the other options as they are.

  • Search Field:
    • Typically, you assign resources to an event by dragging it into a resource's row or column or by creating the event directly in that column. However, you can also select a resource by clicking on it in DayBack's popover and choosing from a list. The search bar at the top of this list uses the "search field" value to determine which field to search when you type. This is usually the resource's name, but you might prefer to search using a formula field. For example, a formula field could return the resource's name only if they are an "active" contractor.
  • Display Field:
    • The display field is usually set to Name , but you can use a formula field here as well. This field appears in the grey search drawer as the "result" of your search.


Including Public Calendars

Records in Salesforce's Activity Object (comprised of Events and Tasks) are usually assigned to a user-owner (a person). However, they can also be assigned to what Salesforce calls a "Public Calendar." DayBack can include these public calendars as resources. Watch this video for more details: Public Calendars.


Mapping to a Formula Field

DayBack can use formula fields for resources, allowing you to combine different fields as resources (e.g., People and Rooms). Although there are several ways to achieve this, using a formula field requires an additional step. You also need to add an event action and possibly create a trigger to ensure DayBack updates the true resource field based on each resource type, instead of the formula field.

Create a Formula Field

  • In your object, create a formula field that returns the resource name as text (e.g., "Exam Room 1 " but without quotes).
  • At this point, you will see your events listed under the correct resource when you filter the calendar for Exam Room 1 .
  • However, at this point, you won't be able to drag an event to a new resource in DayBack because it would attempt to edit your formula field instead of writing back to the true field.

Create a Before Event Save Action

  • To enable dragging events to a new resource, you need to create a "Before Event Save" event action. This action instructs DayBack to edit the actual Resource ID instead of the formula field by identifying which resource type should be written to its corresponding field. Refer to this example for creating such an action: Looking Up A Resource Id By Name.

If creating these actions seems daunting, we are happy to help. Please get in touch for assistance.

Using Triggers 

You can achieve the same effect with a trigger. Here's how:

  1. Set Up a New Text Field:
    • Create a new text field for the resource name and map this field in DayBack
  2. Create a Trigger:
    • Develop a trigger that looks up the ID for the related record and assigns it to the lookup key in your record.
  3. Add a Workflow Rule to the Key:
    • Implement a workflow rule that updates the new text field whenever the key changes outside of DayBack.

For examples of using a trigger, refer to this blog post, which includes detailed instructions on setting the trigger for before insert and before update operations.