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.

Supported REST HTTP Methods

URI
/services/data/v60.0/actions/standard/createServiceDocument
Formats
JSON
HTTP Methods
POST
Authentication
Authorization: Bearer token

Inputs

Input Details
recordId
Type
string
Description
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
Type
string
Description
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
Type
string
Description
Optional. Specifies the language for service document localization. The default is the user’s language. Used when generating a document in a different language from the user’s language. See a list of supported languages in Supported Languages.

You can only input language for locale. For example, use es for Spanish. Using language and country, for example es_ES for Spanish associated with Spain, results in error.

title
Type
string
Description
Optional. The value used to name the document that’s generated and saved.
documentType
Type
string
Description
Optional. Value that allows users to generate different types of documents by using the service. Valid values are:
  • ServiceDocument—Type of service document, such as service agreement or service contract.
  • QuoteDocument—Type of quote document, such as sales quote or service quote.
  • SfsQuoteDocument—Type of quote document for Salesforce Field Service (SFS), suitable for mobile use. This document is stored in the QuoteDocument object, and is generated through flow-based processes that link to related service documents.
The default value is ServiceDocument.
pdfReportId
Type
string
Description
Optional value corresponding to recordId and templateId. However, the value is 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. It must be used to generate a service document from failed state.

Outputs

Inputs Details
pdfReportId
Type
string
Description
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.

Usage

Sample Input

The following code sample generates a PDF of a service document with a specific recordId and templateId:

{

  "inputs":[

   {

     "recordId": "08pOG00000023anYAA",

     "templateId": "0M0OG0000005Na40AE",

     "locale": "en_US",

     "title": "My Awesome PDF"

   }

  ]

}