Loading
Agentforce Field Service and Operations
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Create and Manage Field Service Work Rules

          Create and Manage Field Service Work Rules

          Work rules refine the list of candidates for a service appointment by rejecting service resources that violate any rule. Add work rules to any Field Service scheduling policy to guide schedule optimization.

          Required Editions

          Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience
          The Agentforce Field Service and Operations core features, managed package, and mobile app are available in Enterprise, Unlimited, and Developer Editions.

          Package icon This is a Field Service managed package feature.

          Watch the video to see how to optimize scheduling performance using work rules.

          Create work rules from the Work Rules tab. To view or add work rule fields open the Object Manager in Setup and select the Work Rule custom object. Add work rules to a scheduling policy from the Customize Scheduling Policies page in Guided Setup or from the Scheduling Policy Work Rules related list on a scheduling policy.

          Note
          Note The Service Resource Availability work rule, and the Earliest Start Permitted and Due Date Match Time work rules are mandatory for all scheduling policies. If a user doesn’t see a particular work rule type, they need profile-based access to it. Navigate to the user’s profile in Setup. Under Custom Record Type Settings, click Edit next to Work Rules and move the record type to Selected Record Types.

          Considerations

          Work rules are either database or Apex rules. Each has their own impact on performance and efficiency.

          Database rules are applied at the SOQL query clause level. These rules immediately disqualify resources and query only the resources that you need, so performance isn’t impacted.

          Apex rules are applied after the initial set of service resources are returned from the database SOQL query. Like an Apex “for loop”, Apex rules iterate over all resources returned and must validate that the resources meet specified rule criteria. The additional Apex processing impacts performance.

          Even though Apex rules have a greater impact on performance than database rules do, Apex rules can still be used. Without Apex or database rules to limit the resources found eligible to perform the work, too much work can create a bigger issue for overall performance and even trigger a CPU timeout.

          All database rules are aggregated into one SOQL query and applied in no particular order. Also, because they’re used for grading resources, applying service objectives happens after applying all work rules, increasing the amount of Apex processing.

          Even though service objectives in your scheduling policy can affect performance, specifying service objectives can be necessary and required from a business value standpoint. You can choose to apply service objectives to get the best candidate according to the work rules and company scheduling policy. Or you can choose to get a valid candidate quickly, without affecting performance, by applying just the work rules.

          Database rules are specific work rules used to filter service resources during Appointment Booking, Get Candidates, Schedule, and Emergency Scheduling actions. They're more efficient than other work rules, which filter resources against CPU time. You must include at least 1 database rule in your scheduling policy to minimize the number of candidates during the Appointment Booking and Get Candidates actions. To avoid performance issues, we recommend you use database rules to filter the number of candidates to 20.

          These rules are considered database rules:

          • Maximum Travel From Home
          • Working Territories
          • Match Territory
          • Enhanced Match

          When you’re using Enhanced Scheduling and Optimization, these work rules are also considered database rules:

          • Match Boolean
          • Match Fields
          • Required Resource
          • Excluded Resource

          Field Service Work Rule Types

          • Work Rule Type: Count Rule
            Use a Field Service Apex Count work rule to restrict appointment scheduling based on assignments, hours worked, or a custom value. It’s a great way to prevent overloading your workers or their vehicles.
          • Work Rule Type: Excluded Resources
            The Excluded Resources work rule type prevents service resources, listed as an Excluded service resource preference on a work order or work order line item, from being assigned to the corresponding appointment when the scheduling policy in use includes this work rule. If you're using Enhanced Scheduling and Optimization, the Excluded Resources work rule is a Field Service database work rule type. If you're not using Enhanced Scheduling and Optimization, this is an Apex work rule type.
          • Work Rule Type: Extended Match
            Use the Extended Match database work rule type to schedule service appointments using custom criteria. It uses a junction, or linking, object to match a field on the Service Appointment object to a related list on the Service Resource object.
          • Work Rule Type: Match Boolean
            The Match Boolean work rule type enforces scheduling preferences based on a checkbox (Boolean) field on service resources. If you're using Enhanced Scheduling and Optimization, the Match Boolean work rule is a Field Service database work rule type. If you're not using Enhanced Scheduling and Optimization, this is an Apex work rule type.
          • Work Rule Type: Match Fields
            The Match Fields work rule type matches a service appointment field with a service resource field. It’s a great way to enforce requirements based on custom fields. If you're using Enhanced Scheduling and Optimization, the Match Fields work rule is a Field Service database work rule type. If you're not using Enhanced Scheduling and Optimization, this is an Apex work rule type.
          • Work Rule Type: Match Skills
            Match Skills is a Field Service Apex work rule type that matches a service appointment’s skill requirements with a service resource’s assigned skills. It can also be used to enforce skill level requirements.
          • Work Rule Type: Match Territory
            Match Territory is a database work rule type that ensures service appointments are assigned only to Field Service resources who are primary or relocation members of the appointment's service territory.
          • Work Rule Type: Match Time Rule
            Match Time Rule is a Field Service Apex work rule type that limits the scheduling time frame based on an appointment’s date and time properties. For example, the Due Date work rule ensures that the appointment’s scheduled end is before its due date.
          • Work Rule Type: Maximum Travel from Home
            Maximum Travel from Home is a Field Service database work rule type for setting the maximum distance or travel time between a resource’s home base and any appointment assigned to the resource. It’s a useful way to minimize mobile workers’ travel time.
          • Work Rule Type: Required Resources
            The Required Resources work rule type ensures that a service appointment’s required resource preferences are respected. If a work order or work order line item has a related Resource Preference record of type Required for a particular service resource, a Required Resources work rule ensures that the related service appointments are assigned to that service resource. If you're using Enhanced Scheduling and Optimization, the Required Resources work rule is a Field Service database work rule type. If you're not using Enhanced Scheduling and Optimization, this is an Apex work rule type.
          • Work Rule Type: Service Appointment Visiting Hours
            Service Appointment Visiting Hours is an Apex work rule type that enforces your customers’ operating hours. For example, if an account’s operating hours are weekdays between 8:00 AM and noon, appointments for that customer are scheduled only within those hours.
          • Work Rule Type: Service Crew Resources Availability
            Service Crew Resources Availability is an Apex work rule type that ensures that a service resource of type Crew is assigned to an appointment only if the crew complies with the appointment’s parent record’s minimum crew size.
          • Work Rule Type: Service Resource Availability
            Service Resource Availability is an Apex work rule type that ensures that a service resource is available to perform a service appointment. You can schedule breaks automatically, account for travel time, or set up short breaks between service appointments. A work rule of this type is mandatory for all scheduling policies to ensure that both resource absences and availability are respected during the scheduling process.
          • Work Rule Type: TimeSlot Designated Work
            The Field Service TimeSlot Designated Work Apex work rule type ensures that if a time slot or shift is reserved for a specific type of work, only appointments of that type are scheduled during that time period.
          • Work Rule Type: Work Capacity
            The Work Capacity Apex work rule type sets limits for the work capacity of service resources in a given service territory according to specified criteria. This work rule is available only when you’re using Enhanced Scheduling and Optimization. 
          • Work Rule Type: Working Territories
            Working Territories is a Field Service database work rule type that enforces primary and secondary service territory memberships.
          • Manage Rule Validation Checks
            Set how often rules are checked for violations, and what triggers automatic rule validation checks.
          • Get Rule Violation Analytics for Field Service (Beta)
            Understand the root causes of rule violations in manual scheduling, such as geographical imbalances or skill gaps, and make data-driven decisions by analyzing trends and patterns.
           
          Loading
          Salesforce Help | Article