Quick Starts

Document Generation with CloudFiles

in this quick start guide, you will learn how to integrate salesforce data into your document workflow using the cloudfiles word add in and cloudfiles doc gen lwc you will discover how to install the cloudfiles word add in, create and publish personalized templates, and manually generate documents in your desired format additionally, this guide covers automating the document generation process based on specific triggers and attaching the generated documents to salesforce records, streamlining your document management and improving efficiency for more detailed information, visit document generation docid\ cmqmhkrlb3mveyvyapv9c this article is divided into the following sections insert cloudfiles document generation lwc learn how to insert and configure the cloudfiles document generation lightning web component (lwc) within your salesforce environment to enable seamless document generation install cloudfiles word add in follow the steps to install the cloudfiles word add in, which allows you to create and manage document templates directly within microsoft word create template discover how to create customized word templates using the cloudfiles word add in, leveraging salesforce data to personalize your documents publish template understand the process of publishing your word templates within salesforce, making them available for document generation generate documents learn how to manually generate documents using your published templates automate document generation explore the process of automating the document generation using cloudfiles flow actions & attaching the generated documents to desired salesforce record let's look into each section one by one 1 insert cloudfiles document generation lwc the cloudfiles document generation lightning web component (lwc) can be seamlessly integrated into any object's record detail page within salesforce once incorporated, this widget will showcase all the published templates relevant to that specific object users have the flexibility to generate documents in either docx or pdf formats, which will be automatically downloaded upon creation, simplifying the document management process to add the cloudfiles doc gen widget to a page, navigate to the record detail page of any object and click the “edit page” button this will open the lightning builder for the page within the builder, you can easily drag and drop the "cloudfiles doc gen" widget into your desired location after positioning the widget, save and exit the builder, then refresh the salesforce record page the widget will now display all the published templates associated with that object, making document generation more efficient and accessible for visual understanding, refer to the video below 2 install cloudfiles word add in the cloudfiles word add in facilitates the integration of cloudfiles with your salesforce org, enabling you to create and design templates that incorporate salesforce fields this powerful tool streamlines the process of merging salesforce data into documents, making it easier to generate consistent and accurate templates directly from microsoft word to add the cloudfiles word add in to your microsoft word application, start by launching microsoft word on your pc navigate to the " home " tab and click on " add ins " to explore available options in the add ins window, select " + more add ins " to open the "office add ins" window, then click on " microsoft appsource " to be redirected to appsource microsoft com in the search bar, type "cloudfiles" and browse the results to locate the cloudfiles add in click " get it now " to install the add in once the installation is complete, open word to check the new add in in the "new office add in" sidebar, click "allow and continue" to launch the cloudfiles word add in, ensuring it's ready for use with your salesforce data refer to the video below to have a visual understanding of these steps 3 create template you can create a template for any salesforce object you want using various actions, you can insert object fields, related data, and custom resources additionally, you can add pictures, tables, and set conditions for content insertion, as well as specify the title of the generated documents during the template creation process, you can utilize resources to retrieve data from the connected salesforce org and design the template with these resources using actions once the cloudfiles word add in is installed and the salesforce org is connected, you can start building a template for a selected object to get started, you must select your primary resource, i e , the master object for which you wish to build the template in the cloudfiles add in sidebar, select salesforce as the platform and the salesforce object as the master resource after clicking 'submit,' you will be directed to the next stage of selecting actions and utilizing resources refer to the gif below to have a visual understanding of this process 4 publish template after building a template and reviewing it, the final step is to publish the template publishing makes the template available in your salesforce org for document generation on the specified object to begin, navigate to the 'publish' stage by clicking on 'publish' in the 'stage progress bar' you will then need to choose your publishing option either check the 'publish as a new template' checkbox to publish it as a new template for the object, or check the 'select an existing template' checkbox and choose an existing template from the drop down to update an existing one once you've made your selection, click 'publish' a pop up message confirming 'successfully created a template' will appear, indicating the template has been created to verify the template, you can check the newly created or updated template from the 'cloudfiles doc gen' widget on the object's page or from the 'document generation' tab of the cloudfiles app refer to the gif to have a visual understanding of the steps above 5 generate documents from cloudfiles doc gen lwc once the cloudfiles doc gen lwc is added to the record page and the template has been published, you can start generating documents in either docx or pdf format, which will be automatically downloaded upon generation to manually generate a document from cloudfiles doc gen lwc, navigate to the 'cloudfiles doc gen lwc' on any object page click the drop down menu next to the template you want to use and select either 'generate docx' or 'generate pdf' for the desired document format the document generation process takes a moment once completed, you can either download the generated document or choose 'copy to salesforce files' to upload it as a salesforce file, attaching it to the record in the 'files' section refer to the video below to have a visual understanding of this step 6 automate document generation you can automate document generation using salesforce flow builder and cloudfiles actions based on specific triggers and criteria below, we'll create two flows one to automate document generation using flow action and another to ensure the generated documents are properly attached to the corresponding salesforce records this is how the automation looks like the flows are discussed in brief below flow 1 automate document generation using flow action create a new flow type that suits your needs, such as a record triggered flow add the 'cloudfiles generate document' action to the flow and configure the action by entering the following parameters format choose a format (docx or pdf) template id enter the template id (found in the 'document generation' tab) record id enter the object's record id for which the document is to be generated user id enter the cloudfiles system user's id (the user used to set up cloudfiles in the salesforce org) save and activate the flow when the flow's trigger conditions are met, the action will automatically generate a document and create a content version in salesforce refer the video below to have a visual understanding of these steps a cloudfiles event of type document generated is published upon document generation the generated documents can be handled further through a platform event triggerred flow given below flow 2 handle generated documents using platform event triggered flow create a new platform triggered flow and choose platform event as 'cloudfiles event' configure the flow to handle the generated documents by following these steps 1 add a decision element add a 'decision' element to the flow to identify when a document is generated resource $record > type operator "equals" value document generated 2 get event details add a 'get event details' action set the input value for the 'event' parameter as {!$record} 3 check object type add a 'decision' element to check the object type on which the document is generated set the condition to identify the object type as resource outputs from get event details > documentgenerated > parentid operator "starts with" value object id identifier i e , record id's first 3 digits for account record it is 001 4 get content version add a 'get records' element to get the 'content version' record of the generated document identify the record by id using outputs from get event details > documentgenerated > contentversionid 5 attach the generated document to the record add a 'create records' element to create 'content document link' set the field values as linkedentityid outputs from get event details > documentgenerated > parentid contentdocumentid content version from get generated document s content version > contentdocument id save and activate the flow this will ensure the generated document is attached to the record as a salesforce file in the 'files' section this is how the final flow looks like refer to the gif below to have a visual understanding of these steps to sum up, by following this guide, you can install the cloudfiles word add in, create and publish personalized templates, and automate document generation based on specific triggers additionally, it covers automating the attachment of generated documents to salesforce records, streamlining your document management and improving efficiency