Create Service Document Actions
Create service documents from work orders, work order line items, or service appointments.
This object is available in API version 60.0 and later.
URI: /services/data/v60.0/actions/standard/createServiceDocument
Formats: JSON
HTTP Methods: POST
Authentication: Authorization: Bearer token
| Input | Type | Description |
|---|---|---|
recordId | string | Required. The record ID of a work order, work order line item, or service appointment used to generate the service document. Create a Lightning web component to use a Custom Property Editor (CPE) to validate the recordId to avoid deployment issues. |
templateId | string | Required if the recordId is a work order, work order line item, or service appointment. The ID of the service document template to use when generating the document. |
locale | string | Optional. Specifies the language for service document localization. The default is the user’s language. Used when generating a document in a different language. You can only input language for locale, for example es for Spanish. Using language and country, for example es_ES, results in an error. |
title | string | Optional. The value used to populate the Label field in the generated service report. |
documentType | string | Optional. Value that allows users to generate different types of documents. Use SERVICE_DOCUMENT for service agreements or contracts, QUOTE_DOCUMENT for sales or service quotes, or SFS_QUOTE_DOCUMENT for Salesforce Field Service quote documents (stored in QuoteDocument, generated through flow-based processes). Default is ServiceDocument. |
pdfReportId | string | Optional value corresponding to recordId and templateId. Required if you aren’t generating the document from the default pdfRecord record. For the Document Builder feature, this is a service report ID for a report that is in progress, queued, or failed. Required to generate a service document from a failed state. |
| Output | Type | Description |
|---|---|---|
pdfReportId | string | Required. The report’s record ID that holds the generated PDF. For service documents, the pdfReportId is a service report, and the record is created if the work order, work order line item, or service appointment is passed as the recordId. |
Sample Input
This sample generates a PDF of a service document with a specific recordId and templateId.