---
schema_version: "1"
id: ee3d38dd89cfb449a917b8b585946332d16b5ec8e256ef1a3d38de4bec4accd9
title: SchedulingRule
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_schedulingrule.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_schedulingrule.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: e22145849e3495398c269b79fa42ba1edcc356c246edaf2330fc6e0b8e6918a2
description: Represents a scheduling rule in Workforce Engagement Management. Scheduling rules determine when agents are assigned to shifts.
---
# SchedulingRule

Represents a scheduling rule in Workforce Engagement Management. Scheduling rules determine when agents are assigned to shifts.

## Parent Type

This type extends the [Metadata](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/metadata.htm "The base class for all metadata types. You can’t edit this object. A component is an instance of a metadata type.") metadata type and inherits its fullName field.

## File Suffix and Directory Location

SchedulingRule components have the suffix .schedulingRule and are stored in the SchedulingRules folder.

## Version

SchedulingRule components are available in API version 53.0 and later.

## Special Access Rules

This type is available only if Workforce Engagement is enabled in your org. To view, create, edit, and delete records, the user requires the Workforce Engagement Planner permission set.

## Fields

| Field Name | Description |
| --- | --- |
| isProtected | 
Field Type

boolean

Description

Indicates whether the component is protected (true) or not (false). The default value is false.



 |
| masterLabel | 

Field Type

string

Description

Required. The name of the rule.



 |
| schedulingCategory | 

Field Type

SchedulingCategory (enumeration of type string)

Description

Required. What the scheduling logic applies the rule to. The valid values are:

- A—Service Appointment
- B—Shift





 |
| schedulingRuleParameters | 

Field Type

[SchedulingRuleParameter\[\]](#schedulingRuleParameterID)

Description

Parameters associated with a scheduling rule, such as work limits.



 |
| schedulingRuleType | 

Field Type

SchedulingRuleType (enumeration of type string)

Description

Required. Specifies the type of rule. The valid values are:

- A—Active Resources
- B—Match Skills
- C—Availability
- M—Match Territory
- Q—Match Queue
- RestTimeMinutes—Rest Time in Minutes. Available in API version 56.0 and later.
- W—Work Limit
- LimitNonstandardShifts—Specifies a rule type that limits how many non-standard shifts can be assigned to each agent. Available in API version 54.0 and later.





 |

## SchedulingRuleParameter

Represents a scheduling rule parameter, such as a work limit, that’s associated with a scheduling rule.

| Field Name | Description |
| --- | --- |
| schedulingParameterKey | 
Field Type

SchedulingParameterKey (enumeration of type string)

Description

Required. The scheduling rule parameter key.

- C—Constraint Field Name
- L—Limit Type
- R—Resolution
- T—Time Resolution
- W—Work Unit
- ConsiderAbsence—Consider resource absences when evaluating availability. Available in API version 56.0 and later.
- ConsiderSTM—Consider service territory membership, which defines working hours, when evaluating availability. Available in API version 56.0 and later.





 |
| value | 

Field Type

string

Description

The scheduling rule parameter value.



 |

## Declarative Metadata Sample Definition

The following is an example of a SchedulingRule component.

<?xml version="1.0" encoding="UTF-8"?>
<SchedulingRule xmlns="http://soap.sforce.com/2006/04/metadata">
    <masterLabel\>Max Shifts Per Week</masterLabel\>
    <schedulingCategory\>B</schedulingCategory\>
    <schedulingRuleParameters\>
        <schedulingParameterKey\>C</schedulingParameterKey\>
        <value\>MaxShiftsPerWeek</value\>
    </schedulingRuleParameters\>
    <schedulingRuleParameters\>
        <schedulingParameterKey\>W</schedulingParameterKey\>
        <value\>Shifts</value\>
    </schedulingRuleParameters\>
    <schedulingRuleParameters\>
        <schedulingParameterKey\>R</schedulingParameterKey\>
        <value\>Week</value\>
    </schedulingRuleParameters\>
    <schedulingRuleParameters\>
        <schedulingParameterKey\>L</schedulingParameterKey\>
        <value\>Max</value\>
    </schedulingRuleParameters\>
    <schedulingRuleType\>W</schedulingRuleType\>
</SchedulingRule\>

The following is an example package.xml that references the previous definition.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types\>
        <name\>SchedulingRule</name\>
	<members\>MaxShiftsPerWeek</members\>
    </types\>
    <version\>53.0</version\>
</Package\>

## Wildcard Support in the Manifest File

This metadata type supports the wildcard character \* (asterisk) in the package.xml manifest file. For information about using the manifest file, see [Deploying and Retrieving Metadata with the Zip File](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/file_based_zip_file.htm "The deploy() and retrieve() calls are used to deploy and retrieve a .zip file. Within the .zip file is a project manifest (package.xml) that lists what to retrieve or deploy, and one or more XML components that are organized into folders.").