Loading
Omnistudio Document Generation
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Omnistudio Server-Side Document Generation Integration Procedures

          Omnistudio Server-Side Document Generation Integration Procedures

          The fndSingleDocxServersideLwc Omniscript calls one of three Integration Procedures depending on its ServiceFunction setting. Each of these Integration Procedures calls a different method of the DocumentServiceGateway Apex class by using different parameters.

          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.

          Note
          Note When the server-side document generation is initiated, you will only see the jobId. Once the async document generation is successful, from the Response Text field on the DocumentGenerationProcess page you can retrieve the pdfContentVersionId.

          DocumentServiceGateway_DocGeneration Integration Procedure

          The docGenerationSample/fndSingleDocxServersideLwc Omniscript calls the DocumentServiceGateway_DocGeneration Integration Procedure if its ServiceFunction setting is Server Side Document Generation.

          This Integration Procedure invokes the generateDocument method of the DocumentServiceGateway Apex class. This method generates a Microsoft Word, Microsoft PowerPoint, or .pdf document depending on the specified input parameters provided.

          The input that's passed to the method includes these parameters.

          Input Parameter

          Passed In

          Description

          objectId

          input

          ID of an object such as a Contract, Order, or Quote.

          templateId

          input

          Document Template ID.

          title

          options

          Optional title for the generated document.

          outputFileFormat

          options

          Output file format: either all, docx/pptx, or pdf.

          The output that's passed back to the Integration Procedure includes these parameters.

          Output Parameter

          Description

          docContentVersionId

          ID of the generated document in .docx and .pdf format.

          pdfContentVersionId

          ID of the generated document in .pdf format.

          isSuccessfulTransaction

          Indicates whether the Document Generation Process completed successfully: either true or false.

          errorMessage

          Error message if the Document Generation Process didn't complete successfully.

          jobId

          ID of the completed Document Generation Process.

          DocumentServiceGateway_DocGenerationWithTokenData Integration Procedure

          The docGenerationSample/fndSingleDocxServersideLwc Omniscript calls the DocumentServiceGateway_DocGenerationWithTokenData Integration Procedure if its ServiceFunction setting is Server Side Document Generation w/ Token Data.

          This Integration Procedure invokes the generateDocumentWithTokenData method of the DocumentServiceGateway Apex class. This method generates either a .docx, .pptx, or .pdf document depending on the specified input parameters and token data provided.

          The input that's passed to the method includes these parameters.

          Input Parameter

          Passed In

          Description

          objectId

          input

          ID of an object such as a Contract, Order, or Quote.

          templateId

          input

          Document Template ID.

          tokenDataMap

          input

          Sample data to use instead of data from the template's Omnistudio Data Mapper.

          title

          options

          Optional title for the generated document.

          returnAsPdf

          options

          Indicates whether to generate .pdf output: either true or false.

          keepIntermediate

          options

          Indicates whether to keep the intermediate .docx or .pptx file when generating .pdf output: either true or false.

          The output that's passed back to the Integration Procedure includes these parameters.

          Output Parameter

          Description

          docContentVersionId

          ID of the Generated Document in .docx or .pptx format.

          pdfContentVersionId

          ID of the Generated Document in .pdf format.

          isSuccessfulTransaction

          Indicates whether the Document Generation Process completed successfully: either true or false.

          errorMessage

          Error message if the Document Generation Process didn't complete successfully.

          jobId

          ID of the completed Document Generation Process.

          DocumentServiceGateway_DocGenerationPDF Integration Procedure

          The docGenerationSample/fndSingleDocxServersideLwc Omniscript calls the DocumentServiceGateway_DocGenerationPDF Integration Procedure if its ServiceFunction setting is Server Side PDF Generation.

          This Integration Procedure invokes the convertToPDF method of the DocumentServiceGateway Apex class. This method generates a .pdf document based on either a previously generated .docx or .pptx document.

          The input that's passed to the method includes these parameters.

          Input Parameter

          Passed In

          Description

          objectId

          input

          ID of an object such as a Contract, Order, or Quote.

          contentVersionId

          input

          ID of the Generated Document to convert to .pdf.

          title

          options

          Optional title for the generated document.

          The output that's passed back to the Integration Procedure includes these parameters.

          Output Parameter

          Description

          pdfContentVersionId

          ID of the Generated Document in .pdf format.

          isSuccessfulTransaction

          Indicates whether the Document Generation Process completed successfully: either true or false.

          errorMessage

          Error message if the Document Generation Process didn't complete successfully.

          jobId

          ID of the completed Document Generation Process.

           
          Loading
          Salesforce Help | Article