Step Properties for the Server-Side Omniscript

The fndSingleDocxServersideLwc Omniscript consists of steps, which run sequentially when the Omniscript is invoked. Each step has properties that determine the action the step performs. If you want to change the steps, Salesforce recommends that you either create a new version or clone a copy of this Omniscript.

Omniscript Step

Properties

Script Configuration

Type — docGenerationSample

SubType — fndSingleDocxServersideLwc

EnterObject

ObjectId — The Salesforce Object ID, which is assigned to the contextID later in the SetValues step.

TemplateType — Either Microsoft Word .DOCX Template or Microsoft PowerPoint .PPTX Template.

GetDocumentTemplates

Invokes the ExtractDocumentTemplateByTemplateType Omnistudio Data Mapper, which retrieves all active DOCX or PPTX document templates.

PickTemplate

Displays the document templates in the clmSelectableItems Lightning Web Component.

GenerationOptions

ServiceFunction — The type of document generation: Server Side Document Generation (default), Server Side Document Generation w/ Token Data (see the next step), Server Side PDF Generation, or None.

OutputFileFormat — The document type of the output: Word/PPT & PDF (default), Word/PPT, PDF, or None.

Document Generation Font Source - The source of the font used for rendering values during document generation. Enter Rich Text Editor Font (default) to use the font from the Rich Text field, or Document Font to use the font from the document template instead (this overwrites the Rich Text field's font and applies the template's token font).

DocumentTitle — An optional title for the generated document. Applies if ServiceFunction is set to Server Side Document Generation or Server Side Document Generation w/ Token Data.

DocumentContentVersionId The ID of a previously generated DOCX or PPTX document to be converted to PDF. Applies if ServiceFunction is set to Server Side PDF Generation.

To list previously generated DOCX and PPTX documents, use the Developer Console to run a query like this:

SELECT Id, Title FROM ContentVersion

SetGenerationServiceInputParams

Sets key-value pairs to be passed to one of the subsequent document generation steps. Keys are selectedTemplate, templateType, documentTitle, docxContentVersionId, templateId, objectId, outputFileFormat, tokenDataMap, attachFileFormat, downloadFileFormat, and contextId.

If the ServiceFunction in the previous step is set to Server Side Document Generation w/ Token Data, the tokenDataMap is used instead of the Data Mapper associated with the template. This key lets you test document generation with sample data.

ServerSideDocGeneration

Performs document generation if ServiceFunction is set to Server Side Document Generation. Invokes the DocumentServiceGateway_DocGeneration Integration Procedure, which invokes the DocumentServiceGateway Apex class.

When you define remote action to call a remote class, you must also specify the namespace. Remote class name format is <namespace>.<classname>, for example, omnistudio.DocumentServiceGateway.

ServerSidePdfGeneration

Performs document generation if ServiceFunction is set to Server Side PDF Generation. Invokes the DocumentServiceGateway_DocGenerationPDF Integration Procedure, which invokes the DocumentServiceGateway Apex class.

When you define remote action to call a remote class, you must also specify the namespace. Remote class name format is <namespace>.<classname>, for example, omnistudio.DocumentServiceGateway.

ErrorHandling

Displays an error message if document generation was unsuccessful.

ResponseMessage

Displays a JobId if the document generation job completed successfully.