---
schema_version: "1"
id: 9ca4370eb627d6f6ccff4f86c75d0967e7408b08e5cf44094a7741d16527a780
title: Service Report Template
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-servicereporttemplate.md
canonical_url: https://developer.salesforce.com/docs/service/field-service-dev/guide/fsl-dev-servicereporttemplate.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: a2a5ddbfc49f0a7e9a38cc2a1d6acdb8a7bcdef72d3221ee03b9c4d03abb261c
products:
  - Field Service Developer Guide
  - Service Cloud Developer Content
---

# Service Report Template

Returns information corresponding to one or more service report templates in field service. This resource is available in REST API version 40.0 and later.

This resource allows users to input one or more service report template IDs, and responds with information about the templates. Service reports can be generated for work orders, work order line items, and service appointments.

ServiceReportTemplate is available to API users in orgs where Field Service is enabled. It is also enabled for Experience Builder sites.

## Syntax

**URI**: `/services/data/vXX.X/support/fieldservice/ServiceReportTemplate`

**Formats**: JSON

**HTTP Method**: GET

**Authentication**: `Authorization: Bearer TOKEN`

Where `TOKEN` is a variable.

**Parameters**:

| Parameter       | Description                                                                                                                                                                                                                                                                                                                                                                |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `templateIds`   | The list of service report template IDs, provided as comma-separated string values. The API response shows a failure if any template ID is invalid.                                                                                                                                                                                                                        |
| `showDefault`   | A boolean parameter indicating whether the default service report template is returned in the response. If `true`, the default template is included; if `false` (default), the default template is not included. For example, if a request lists the IDs of two non-default templates and `showDefault=true`, the response will include information for three templates.   |
| `templateTypes` | The type of record that the report template can be used for: ServiceAppointment, WorkOrder, or WorkOrderLineItem. Service report templates include four customizable sub-templates:<ul><li>`WO`—Work Order</li><li>`WOLI`—Work Order Line Item</li><li>`WO_SA`—Service Appointment for Work Order</li><li>`WOLI_SA`—Service Appointment for Work Order Line Item</li></ul> |

## Response Body

A service report has three main areas which cannot be deleted: **Header**, **Body** and **Footer**. Each area must contain at least one component—a **section**, **related list**, or **signature**—though the component can be empty. The Header and Footer come with a predefined section, and additional components cannot be added to them. The Body can contain one or more of each component.

**Section** components have these properties.

| Field             | Type              |
| ----------------- | ----------------- |
| `title`           | String            |
| `hideTitle`       | Boolean           |
| `hideFieldLabels` | Boolean           |
| `columns`         | Enum {1, 2}       |
| `rightAlignment`  | Enum {true,false} |
| `fields`          | Array of {Field}  |

A **field** can be added to a section, related list, or signature. Columns in related lists are transformed into fields in the API. Field components have these properties.

<sfdocstbl><table>

<col>
</col>
<col>
</col>
<thead>
  <tr>
    <th>
      Field
    </th>
    <th>
      Type
    </th>
  </tr>
</thead>
<tbody>
  <tr>
    <td>
      <code>fieldType</code>
    </td>
    <td>
      Enum {rta, entityField, blank}
      <p>
        If the field type is rta, the field also contains {“richTextValue” : “&lt;html value&gt;”}.
      </p>
      <p>
        If the field type is entityField, the field also contains {“entityName” : “&lt;WorkOrder&gt;”, “fieldName” : “Account”}.
      </p>
      <p>
        If the field type is blank, no other information is required.
      </p>
    </td>
  </tr>
  <tr>
    <td>
      <code>row</code>
    </td>
    <td>
      Position
    </td>
  </tr>
  <tr>
    <td>
      <code>column</code>
    </td>
    <td>
      Position
    </td>
  </tr>
</tbody>
</table></sfdocstbl>

**Related list** components have these properties.

| Field               | Type                                                      |
| ------------------- | --------------------------------------------------------- |
| `title`             | String                                                    |
| `hideTitle`         | Boolean                                                   |
| `entityName`        | String                                                    |
| `relatedListName`   | String                                                    |
| `relatedEntityName` | String                                                    |
| `fields`            | Array of {Field Name (String), Column Position (Integer)} |

**Signature** components have these properties.

| Field             | Type                                                  |
| ----------------- | ----------------------------------------------------- |
| `title`           | String                                                |
| `hideTitle`       | Boolean                                               |
| `hideFieldLabels` | Boolean                                               |
| `columns`         | Enum {1, 2}                                           |
| `rightAlignment`  | Enum {true,false}                                     |
| `signatureType`   | Dynamic Enum {\<technician 1>, \<dispatcher 1>}       |
| `fields`          | Array of {Field Name (String), Position (Row,Column)} |

## Example

This example request uses two service report template IDs.

**Request**:

`GET`

`/services/data/v42.0/support/fieldservice/ServiceReportTemplate?templateIds=0SLxx0000000ABC, 0SLR000000001QtOAI&showDefault=false&templateTypes=ServiceAppointment`

**Response**:

```nolang
{
  "serviceReportTemplates": [
    {
      "defaultTemplate": false,
      "error": {
        "errorCode": "INVALID_TEMPLATE_ID",
        "errorMessage": "The Service Report Template ID is invalid."
      },
      "subTemplates": [],
      "templateId": "0SLxx0000000ABC"
    },
    {
      "defaultTemplate": false,
      "error": null,
      "subTemplates": [
        {
          "regions": [
            {
              "sections": [
                {
                  "columns": 2,
                  "hideFieldLabels": false,
                  "hideTitle": false,
                  "items": [
                    {
                      "position": {
                        "column": 0,
                        "row": 0
                      },
                      "richText": "<img alt=\"User-added image\" src=\"https://mobile1.file.force.com/servlet/rtaImage?eid=0QRR000000008oZ&amp;feoid=Data&amp;refid=0EMR00000000DGK\"></img>",
                      "type": "rta"
                    },
                    {
                      "position": {
                        "column": 1,
                        "row": 0
                      },
                      "richText": "<u><i>Salesforce.com</i></u>",
                      "type": "rta"
                    }
                  ],
                  "position": 0,
                  "rightAlign": false,
                  "title": "Service Report",
                  "type": "section"
                }
              ],
              "type": "HEADER"
            },
            {
              "sections": [
                {
                  "columns": 2,
                  "hideFieldLabels": false,
                  "hideTitle": true,
                  "items": [],
                  "position": 0,
                  "rightAlign": false,
                  "showPageNumber": false,
                  "title": "Footer Section",
                  "type": "section"
                }
              ],
              "type": "FOOTER"
            },
            {
              "sections": [
                {
                  "columns": 2,
                  "hideFieldLabels": false,
                  "hideTitle": false,
                  "items": [
                    {
                      "entityName": "ServiceAppointment",
                      "label": "Account",
                      "name": "AccountId",
                      "position": {
                        "column": 0,
                        "row": 0
                      },
                      "type": "entityField"
                    },
                    ...
                    {
                      "position": {
                        "column": 1,
                        "row": 0
                      },
                      "richText": "Prepared By:",
                      "type": "rta"
                    }
                  ],
                  "position": 0,
                  "rightAlign": false,
                  "title": "Account & Contact Information",
                  "type": "section"
                },
                {
                  "entityName": "WorkOrder",
                  "filterCriteria": {
                    "conditions": [
                      {
                        "field": "Status",
                        "operation": "includes",
                        "position": 0,
                        "values": [
                          "In Progress",
                          "Completed"
                        ]
                      }
                    ]
                  },
                  "hideTitle": false,
                  "items": [
                    {
                      "column": 0,
                      "label": "Work Order Line Item Number",
                      "name": "LineItemNumber"
                    },
                    ...
                    {
                      "column": 6,
                      "label": "Unit Price",
                      "name": "UnitPrice"
                    }
                  ],
                  "position": 5,
                  "relatedEntityName": "WorkOrderLineItem",
                  "relatedListName": "WorkOrderLineItems",
                  "title": "Work Order Line Items",
                  "type": "relatedList"
                },
                {
                  "columns": 1,
                  "hideFieldLabels": false,
                  "hideTitle": false,
                  "items": [
                    {
                      "entityName": "DigitalSignature",
                      "label": "Signature",
                      "name": "Document",
                      "position": {
                        "column": 0,
                        "row": 0
                      },
                      "type": "entityField"
                    },
                    {
                      "entityName": "DigitalSignature",
                      "label": "Signed By",
                      "name": "SignedBy",
                      "position": {
                        "column": 0,
                        "row": 1
                      },
                      "type": "entityField"
                    },
                    {
                      "entityName": "DigitalSignature",
                      "label": "Date",
                      "name": "SignedDate",
                      "position": {
                        "column": 0,
                        "row": 2
                      },
                      "type": "entityField"
                    }
                  ],
                  "position": 9,
                  "rightAlign": false,
                  "signatureType": "Default",
                  "signatureTypeLabel": "Default",
                  "title": "Customer Signature",
                  "type": "signature"
                }
              ],
              "type": "BODY"
            }
          ],
          "subTemplateType": "WO_SA"
        },
        {
          ...
          "subTemplateType": "WOLI_SA"
        }
      ],
      "templateId": "0SLR000000001QtOAI"
    }
  ]
}
```
