---
schema_version: "1"
id: 966cfc5cc43c95271a787006b391a494fa72107245c02c23589fc6b4dbd3f71a
title: Field Service Code Examples
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/field-service-dev/guides/field-service/source-files/fsl-dev-code-samples.md
canonical_url: https://developer.salesforce.com/docs/service/field-service-dev/guide/fsl-dev-code-samples.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 637b1a502990c6a060360fea8829c792d53c05beb23c5ffc0b657488af41e65c
products:
  - Field Service Developer Guide
  - Service Cloud Developer Content
---

# Field Service Code Examples

Use these code examples to get started working programmatically with Field Service features.

-   **[Create a Service Report with Apex](https://developer.salesforce.com/docs/service/field-service-dev/guide/fsl-dev-code-samples-sr.md)**  


    The Create Service Report action on work orders, work order line items, and service appointments can also be called using Apex code. The code example shown creates a service report with two signatures by making an Apex callout to the `createServiceReport` action REST API resource.

-   **[Generate Work Orders on Maintenance Plans with Apex](https://developer.salesforce.com/docs/service/field-service-dev/guide/fsl-dev-code-samples-wo.md)**  


    The **Generate Work Orders** action on maintenance plans can also be called using Apex code. The following code sample creates work order records by making an Apex callout to the `generateWorkOrder` action REST API resource.

-   **[Code Examples: Dispatcher Console Custom Actions](https://developer.salesforce.com/docs/service/field-service-dev/guide/fsl-dev-code-samples-dispatcher.md)**  


    Learn how to configure Apex classes or Visualforce pages that you want to link to a custom action in the dispatcher console.

-   **[Create Service Appointment Lists in the Dispatcher Console](https://developer.salesforce.com/docs/service/field-service-dev/guide/fsl-dev-code-samples-sal.md)**  


    You can create user-specific temporary appointment lists by adding the `Create Temporary Service Appointment List` custom permission in Field Service managed package. If the custom permission is enabled, the Field Service app creates a connection to the `CreateFilterEvent__e` platform event channel and subscribes to related messages.


