Document Templates (GET, PATCH, POST)

Access document template actions, including template creation with the Document Template Designer.

Resource 

1/connect/docgen/document-templates

GET Example 

1https://YOUR_INSTANCE.salesforce.com/services/data/v68.0/connect/docgen/document-templates?offset=${offset}&limit=${limit}&searchString=${searchString}

PATCH Example 

1https://YOUR_INSTANCE.salesforce.com/services/data/v68.0/connect/docgen/document-templates?documentTemplateId=${documentTemplateId}

POST Example 

1https://YOUR_INSTANCE.salesforce.com/services/data/v68.0/connect/docgen/document-templates?documentTemplateId=${documentTemplateId}&action=${action}

Available Version 

60.0

HTTP Methods 

GET, PATCH, POST

Request Parameters for GET 

Parameter NameTypeDescriptionRequired or OptionalAvailable Version
cloneOnlyStringFilters the results to return only the document templates that can be cloned.Optional66.0
limitStringNumber of document templates per page. The default value is 20.Optional60.0
offsetStringNumber of records to skip. The default value is 0.Optional60.0
searchStringStringSearch term that is used to retrieve a list of document templates.Optional60.0
typeStringFilters the list of document templates by the file type.Optional66.0
usageTypeStringFilters the list of document templates by the usage type.Optional66.0

Response Body for GET 

Document Template List

Request Body for PATCH 

JSON Example

1{
2  "isActive": "false",
3  "status": "Draft",
4  "documentGenerationMechanism": "ClientSide",
5  "extractOmniDataTransformName": "Extractor",
6  "mapperOmniDataTransformName": "Mapper",
7  "shouldDisplayUnmappedToken": "false",
8  "tokenList": "token1,token2,token3",
9  "tokenMappingMethodType": "ContextService",
10  "contextDefinitionName": "QuoteProposal",
11  "contextMappingName": "QuoteToContextMapping",
12  "customClassName": "QuoteBundleTransformer", 
13  "contextFilterName": "QuoteWithLargeQtyLineItems",
14  "contextTransformationName": "QuoteBundleTransformation",
15  "usageType": "Contract_Lifecycle_Management",
16  "contentDocumentId": "069xxxxxxxxxxxxxxx"
17}

Properties

NameTypeDescriptionRequired or OptionalAvailable Version
content​Document​IdStringID of the document associated with a document template.Optional60.0
contextDefinition​NameStringName of the context definition that contains the mapping details used for extraction in the Context Service token mapping type.Required if the tokenMappingMethodTypeproperty is set to ContextService.64.0
contextMapping​NameStringName of the context mapping used for extraction in the Context Service token mapping type.Required if the tokenMappingMethodTypeproperty is set to ContextService.64.0
contextFilter​NameStringName of the context filter that’s used to filter, order, or limit the data extracted from the context service at run time. This property is available only when tokenMappingMethodType property value is ContextService.Optional66.0
contextTransformation​NameStringName of the context transformation that’s used to transform the data extracted from the context service at run time. This property is available only when tokenMappingMethodType property value is ContextService.Optional67.0
customClass​NameStringName of a custom Apex class that’s used to transform token data before document generation. This property is available only when tokenMappingMethodType property value is ContextService.Optional66.0
document​Generation​MechanismStringSpecifies the method for generating the document. Possible values are Client-side or Server-side. The default value is Client-side.Optional60.0
extract​OmniData​Transform​NameStringName of the OmniDataTransform bundle of the extract type.Optional60.0
isActiveBooleanIndicates whether the document template is set to active (true) or inactive (false).Optional60.0
mapper​OmniData​Transform​NameStringName of the OmniDataTransform bundle of the mapper type.Optional60.0
should​Display​Unmapped​TokenBooleanIndicates whether the document template unmapped tokens be displayed (true) or not (false).Optional60.0
statusStringStatus to be set for the document template.Optional60.0
tokenListStringList of tokens present in the document template.Optional60.0
token​Mapping​MethodTypeStringProcessing method for data that can originate from the same source object. Possible values are ContextService or OmniDataTransform. The default value is ContextService.Required60.0
usageTypeStringUsage type of the document template.Optional60.0

Request Parameters for PATCH 

Parameter NameTypeDescriptionRequired or OptionalAvailable Version
documentTemplateIdStringID of the document template for operations like cloning or creating a new version.Required60.0
documentTemplateUpdateInputObjectSpecifies the details to modify an existing document template.Optional64.0

Response Body for PATCH 

Document Template

Request Body for POST 

JSON Example

1{
2  "name": "TemplateName",
3  "type": "MicrosoftWord/MicrosoftPowerpoint/Microsoft365Word",
4  "tokenMappingMethodType": "OmniDataTransform",
5  "tokenMappingType": "JSON",
6  "extractOmniDataTransformName": "ExtractName",
7  "mapperOmniDataTransformName": "MapperName",
8  "contentDocumentId": "069xx0000004CyeAAE",
9  "documentGenerationMechanism": "ServerSide",
10  "usageType": "Contract_Lifecycle_Management",
11  "tokenList": "token1,token2,token3"
12}

This example shows a sample request with ContextService as the value of the tokenMappingMethodType property.

1{
2  "name": "TemplateName",
3  "type": "MicrosoftWord/MicrosoftPowerpoint/Microsoft365Word",
4  "tokenMappingMethodType": "ContextService",
5  "contextDefinitionName": "QuoteProposal",
6  "contextMappingName": "QuoteToContextMapping", 
7  "customClassName": "QuoteBundleTransformer", 
8  "contextFilterName": "QuoteWithLargeQtyLineItems",
9  "contextTransformationName": "QuoteBundleTransformation",
10  "tokenMappingType": "JSON",
11  "extractOmniDataTransformName": "ExtractName",
12  "mapperOmniDataTransformName": "MapperName",
13  "contentDocumentId": "069xx0000004CyeAAE",
14  "documentGenerationMechanism": "ClientSide",
15  "usageType": "Contract_Lifecycle_Management",
16  "tokenList": "token1,token2,token3"
17}

Properties

NameTypeDescriptionRequired or OptionalAvailable Version
content​DocumentIdStringID of the Document associated with a document template.Optional60.0
contextDefinition​NameStringName of the context definition that contains the mapping details used for extraction in the Context Service token mapping type.Required if the tokenMappingMethodTypeproperty is set to ContextService.64.0
contextMapping​NameStringName of the context mapping used for extraction in the Context Service token mapping type.Required if the tokenMappingMethodTypeproperty is set to ContextService.64.0
contextFilter​NameStringName of the context filter that’s used to filter, order, or limit the data extracted from the context service at run time. This property is available only when the tokenMappingMethodType property value is ContextService.Optional66.0
contextTransformation​NameStringName of the context transformation that’s used to transform the data extracted from the context service at run time. This property is available only when the tokenMappingMethodType property value is ContextService.Optional67.0
customClass​NameStringName of a custom Apex class that’s used to transform token data before document generation. This property is available only when the tokenMappingMethodType property value is ContextService.Optional66.0
document​Generation​MechanismStringSpecifies the method for generating the document. Possible values are Client-side or Server-side. The default value is Client-side.Optional60.0
extractOmniDataTransformNameStringName of the OmniDataTransform bundle of the extract type.Optional60.0
mapper​OmniData​Transform​NameStringName of the OmniDataTransform bundle of the mapper type.Optional60.0
nameStringName of the document template.Required60.0
tokenListStringList of tokens present in the document template.Optional60.0
token​Mapping​MethodTypeStringProcessing method for the data that can originate from same source object. Possible values are ContextService or OmniDataTransform. The default value is ContextService.Required60.0
token​Mapping​TypeStringMapping type for tokens of the document template.Required60.0
typeStringType of document template.Required60.0
usageTypeStringUsage type of the document template.Optional60.0

Request Parameters for POST 

Parameter NameTypeDescriptionRequired or OptionalAvailable Version
actionStringAction to be performed on the document template. Possible values are Clone or NewVersion.Optional60.0
documentTemplateObjectSpecifies the details of a new document template resource.Optional64.0
documentTemplateIdStringID of the document template for operations like cloning or creating a new version.Optional60.0

Response Body for POST 

Document Template