---
schema_version: "1"
id: 111f84aa7d0f53f1b075b4bacd4690541161b9165e2a42a6b3119cd943e4f55b
title: FieldService Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_ConnectAPI_FieldService_static_methods.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_FieldService_static_methods.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 037e7a1b92247e600a1c86aad85b6166b54add03483d8f7b66a062bd5118d31a
description: Preview and create shifts from a pattern.These methods are for FieldService. All methods are static.Create up to 2,000 shifts from a pattern.Preview up to 2,000 shifts from a pattern.
---
# FieldService Class

Preview and create shifts from a pattern.

## Namespace

[ConnectApi](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_connect_api.htm "The ConnectApi namespace (also called Connect in Apex) provides classes for accessing the same data available in Connect REST API. Use Connect in Apex to create custom experiences in Salesforce.")

## FieldService Methods

These methods are for FieldService. All methods are static.

- **[createShiftsFromPattern(shiftsFromPatternInput, shiftPatternId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_FieldService_static_methods.htm#apex_ConnectAPI_FieldService_newShiftsFromPattern_2)**  
    Create up to 2,000 shifts from a pattern.
- **[previewShiftsFromPattern(shiftsFromPatternInput, shiftPatternId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_FieldService_static_methods.htm#apex_ConnectAPI_FieldService_previewShiftsFromPattern_1)**  
    Preview up to 2,000 shifts from a pattern.

### createShiftsFromPattern(shiftsFromPatternInput, shiftPatternId)

Create up to 2,000 shifts from a pattern.

#### API Version

51.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ShiftsFromPattern createShiftsFromPattern(ConnectApi.ShiftsFromPatternInput shiftsFromPatternInput, String shiftPatternId)

#### Parameters

shiftsFromPatternInput

Type: [ConnectApi.ShiftsFromPatternInput](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_new_shifts_from_pattern.htm "Shifts from a pattern.")

A ConnectApi.ShiftsFromPatternInput object providing the pattern.

shiftPatternId

Type: String

ID of the shift pattern.

#### Return Value

Type: [ConnectApi.ShiftsFromPattern](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_new_shifts_from_pattern.htm "Shifts created from a pattern.")

### previewShiftsFromPattern(shiftsFromPatternInput, shiftPatternId)

Preview up to 2,000 shifts from a pattern.

#### API Version

51.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.ShiftsFromPattern previewShiftsFromPattern(ConnectApi.ShiftsFromPatternInput shiftsFromPatternInput, String shiftPatternId)

#### Parameters

shiftsFromPatternInput

Type: [ConnectApi.ShiftsFromPatternInput](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_new_shifts_from_pattern.htm "Shifts from a pattern.")

A ConnectApi.ShiftsFromPatternInput object providing the pattern.

shiftPatternId

Type: String

ID of the shift pattern.

#### Return Value

Type: [ConnectApi.ShiftsFromPattern](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_new_shifts_from_pattern.htm "Shifts created from a pattern.")