Flow Actions
Doc Generation Flow Actions
Get Doc-Gen Templates
introduction the cloudfiles get doc gen templates action is a salesforce flow apex action that retrieves all cloudfiles document generation templates associated with a specific salesforce object type it is typically used as a preparatory step before generating documents — allowing your flow to dynamically look up and select the right template based on your automation logic, rather than hardcoding a template id what this action does all your doc gen templates can be viewed and managed under the cloudfiles app → document generation → docgen templates section each template in this list is associated with a source salesforce object (e g , account , lead , purchase order c ) and has a unique template id, version number, and other metadata the cloudfiles get doc gen templates action allows you to programmatically fetch this same list — filtered by object type — directly within a salesforce flow when executed, cloudfiles get doc gen templates queries the cloudfiles platform and returns a collection of all doc gen templates configured for the given salesforce object type (e g , account ) this is the same list of templates you would see when browsing the cloudfiles app → document generation → docgen templates section and filtering by a particular source object this action is especially useful when you need to filter or choose templates at runtime, enabling flexible and intelligent document generation workflows within salesforce flow builder input parameters object type the api name of the salesforce object for which you want to retrieve doc gen templates this should match the object type as configured against your cloudfiles doc gen templates (e g , account , contact or a custom object such as purchase order c ) example entering account will return all cloudfiles doc gen templates whose master source object is set to account output parameters the action returns a single output — templates cldfs docgentemplatelist — which is a collection of records of the custom apex type template each item in the returned collection represents one template and exposes the following fields field type description id text the unique identifier of the template in cloudfiles name text the display name of the template (e g , proposal presentation) kind text the template file type (e g , docx, pptx, xlsx, pdf) description text a short description of the template, if configured createdat datetime the timestamp when the template was created createdby text the user who created the template versionnumber number the current version number of the template the collection can then be used according to the use case — for example, filtering a template by name before passing it to a generate document action downstream using the output in your flow since the output is a collection , you will typically follow the pattern below after the action is added to your flow step 1 — add the action in flow builder, add the cloudfiles get doc gen templates apex action to your flow set the object type input to the api name of the relevant salesforce object (e g , account ) the output resource templates will be automatically available for use in subsequent elements step 2 — add a loop element add a loop element immediately after the action set its collection variable to the templates output of the action (shown as outputs from get account object doc gen templates > templates) this will iterate over every template returned for that object type, one at a time step 3 — add a decision element inside the loop inside the loop, add a decision element to identify the specific template you want to use use the current loop item's fields as the resource — for example, set the resource to current item from loop > name, the operator to equals, and the value to the template name you want to match (e g , pre sale proposal or annual report) you can define multiple outcomes in a single decision element to handle different templates in the same flow step 4 — generate the document on the matching decision outcome path, add your cloudfiles generate document or cloudfiles generate document (sync) action pass the relevant fields of the matched template (such as id) into the generate document action as the template input