You are here:
Using the docGenerationSample/singleDocxVF Omniscript
This Omniscript generates documents from your Microsoft Word DOCX templates or your Microsoft PowerPoint PPTX templates. You enter the Object ID, pick a template, select different options for generating, and the Omniscript generates the document.
In Spring '25, Salesforce has retired Visualforce-based document generation Omniscripts included in the Install DocGenerationSample datapack from the Industries Communications, Media, Energy & Utilities (CME), and Insurance (INS) managed packages. Salesforce won't support or upgrade the sample or cloned versions of the retired VF Omniscripts. You must transition to the Lightning Web Components-based Omniscripts, which are already available in the Install DocGenerationSampleLwc datapack of these managed packages. See Visualforce-Based Document Generation Omniscripts Are Being Retired .
Omniscript Steps
-
Enter Object ID
You are required to make a selection for both fields.
Template Type Microsoft Word DOCX or Microsoft PowerPoint PPTX
-
Pick A Template
Select a template, or search for a template and then select it.
-
Generation Options
You can use the default values, or you can select different values for downloading, attaching, document generation, and PDF generation. You can select the option of --clear-- if you want the fields to be blank.
If the fields are blank, the Omniscript uses the settings in the document template and if they aren't set there, the Omniscript uses the organization-level settings.
-
Generate Document
The Omniscript generates the document, and you can download and email the document according to your generation options.
Omniscript Structure
Review these properties in this Omniscript. If you want to make changes to the structure, Vlocity recommends that you clone a copy of this Omniscript and rename it.
-
Script Configuration
-
EnterDetails
ObjectId This is the Salesforce Object ID that will be assigned to contextID later in the Set Values step.
Template Type You can use either a Microsoft Word (DOCX) template or Microsoft PowerPoint (PPTX) template.
-
GetDocumentTemplates
This Data Mapper extract step retrieves all active all active DOCX or PPTX Templates(JSON Based) using the DocGenSample-GetDocumentTemplatesForType Data Mapper Interface.
-
PickTemplate
This step captures the different IDs of the templates using the DocumentTemplate selectable list.
-
Set Values
This step sets the required variables for document generation.
contextId Salesforce Object ID
templates Selected template IDs
templateType Microsoft Word (DOCX) template or Microsoft PowerPoint (PPTX) template
-
GenerationOptions
This sets the values for generation options for the following fields:
DownloadFileFormat What type of document do you want to download?
-
all (default) You can download all file formats.
-
docx You can download Microsoft Word files.
-
pptx You can download Microsoft PowerPoint files.
-
pdf You can download PDF files.
-
none You cannot download any files.
AttachFileFormat What file type do you want to attach?
-
docx (default) You can attach Microsoft Word files.
-
pptx You can attach Microsoft PowerPoint files.
-
pdf You can attach PDF files.
-
docx, pdf You can download Microsoft Word and PDF files.
-
pptx, pdf You can attach Microsoft PowerPoint files and PDF files.
-
none You cannot attach any files.
Document Viewer What do you want to use to preview your document?
-
VlocityClientSideViewer (default) You use the Vlocity Client Side Viewer to preview the document.
-
None You cannot preview the document.
DocGenerationMechanism What do you want to use to generate your document?
-
VlocityClientSide (default) You use Vlocity Client side to generate the document.
-
VlocityCloud This feature is for beta users only.
-
VlocityClientSide (default) The PDF is generated by Vlocity Client Side.
-
Salesforce The PDF is generated by Salesforce.
-
Vlocity Cloud This feature is for beta users only.
UseTemplateDRExtract Do you want to use the Data Mapper in the template or do you want to provide data extracted within the Omniscript?
-
Yes (default) Token values are extracted from the Data Mapper associated with the template you're using.
-
No Token values need to be available in Omniscript data and mapped in the template's Data Mapper. You must make sure that all the token mapping of that Data Mapper in the template is mapped with the Omniscript data.
DisplayTitle This gives the option to overwrite the file name for display purposes in the document preview.
-
-
Set Generation Options
In this step, the values from the previous step are mapped to the corresponding variables.
-
Generate Document
This step generates the document with the option of sending an email with the generated document attached.
The HTML template docgensample-object-document-creation-docx-template uses JavaSript to invoke Apex classes for document generation.
The components ValidateVariables and ValidateMessage are used for validation to make sure that the required variables (templateId, contextID, templateType) are correctly set before document generation.





