This article answers common questions about using Box Doc Gen in Salesforce. For setup steps, see Setting up Box Doc Gen in Salesforce.
General
What is Box Doc Gen for Salesforce?
Box Doc Gen for Salesforce lets you generate documents from Salesforce by merging Salesforce record data into templates stored in Box. It's part of the Box for Salesforce managed package.
What can I use it for?
Common use cases include:
- Sales proposals and quotes generated from Opportunities
- Contracts, agreements, and NDAs generated from Account or Contact records
- Customer onboarding documents
- Reports that include photos, such as inspection or claim reports
- Documents sent for approval and signature with Box Sign
Which version of Box for Salesforce do I need for nested tables, the Doc Gen Template Tagger, and data sources?
These features are available in Box for Salesforce v5.64 and later. You can check your installed version, and whether a newer version is available, on the Box Troubleshooting page.
Who can create templates, and who can generate documents?
Box Doc Gen uses two permission sets, assigned from Box Settings > Assign Permissions:
- Box Doc Gen Template Manager — for users who create, edit, or set up templates.
- Box Doc Gen Users — for users who generate documents.
Templates
How do I create a template?
From the App Launcher, open Box Doc Gen Templates and click New. The template manager walks you through naming the template, choosing its Salesforce object, uploading your template file, previewing it on a sample record, and choosing settings.
Can I choose the format of the generated document?
Yes. Choose the Output type in the Settings step of the template manager.
Can the generated file name include record data?
Yes. In Generated File Name, you can include merge fields, for example Quote_{{Opportunity.Name}}.
Can I test a template before users start generating documents?
Yes, in two ways:
- In the Preview step of the template manager, test the template on a sample record.
- On the template record, open the Preview Payload tab to see the exact data that would be merged into a document for a sample record.
Can a template be used on more than one Salesforce object?
No. Each template is created for one Salesforce object, which you choose in the Create Template step. To generate the same kind of document from a different object, create a separate template for that object.
Can I include images in generated documents?
Yes. Use a data source to add images Box Record-Folder Images - images already stored in the record's Box folder (or a parent or child record's folder) - to your template's data. See Using Data Sources.
How do I add an image to my Word template?
Image tags go in a picture's alt text, not in the body of the document. Insert a placeholder picture where you want the image, size it, and set its alt text to the image tag, for example { "image-path": "Opportunity.Logo_URL" }. For a set of images, place the placeholder between {{ for img in ... }} and {{ endfor }} tags. For step-by-step instructions, see "Adding images to your template" in Using Data Sources.
Nested Tables
What are nested tables?
Nested tables let a template include rows from a record's child records, and from those child records' own children. For example, an Opportunity template can include a table of invoices and their invoice lines (Opportunity.Invoices.InvoiceLines).
How many levels deep can nested tables go?
Up to five levels of parent<>child relationships from the template's object.
How do I create a nested table tag?
On the Tagger's Tables tab, select a Child Relationship, optionally select further levels (Level 2 Relationship and beyond), select the columns you want, and click Generate Table Tag.
Learn more: Building a nested table tag on the Tables tab
What's the difference between nested tables and data sources?
Nested tables include data from the template object's child records, following standard Salesforce relationships. Data sources bring in data that isn't available that way, such as the results of a SOQL query, images from Box, or data returned by Apex or a Flow. You can use both in the same template.
Data Sources
What data source types are available?
SOQL, Apex, Flow, and Box Record-Folder Images. See Using Data Sources for how to set up each one.
Where do I create data sources?
From the App Launcher, open Box Doc Gen Data Sources and click New. Each data source belongs to one template, which you select in the Doc Gen Template field.
Can a template have more than one data source?
Yes. Use Execution Order to set the order in which they run.
Can I turn off a data source without deleting it?
Yes. Clear the Is Active checkbox on the data source.
How can I check what a data source returns?
Open the Preview Payload tab on the data source to see its data, or the Preview Payload tab on the template to see the data from all active data sources for a sample record.
Generating Documents
How do users generate a document?
From a record page, using the Box Doc Gen button your admin adds to the object's page layout. See "Adding and Displaying the Box Doc Gen Button in Objects" in Setting up Box Doc Gen in Salesforce.
Can users generate documents for multiple records at once?
Yes. Admins can add a Batch Doc Gen button to an object's List View, so users can generate documents for multiple records at once. See "Setting up Batch Doc Gen" in Setting up Box Doc Gen in Salesforce.
Where are generated documents saved?
In the applicable record’s Box for Salesforce folder.
Which Box account generates the documents?
Documents are generated by the Box Service Account. Viewing documents and Box UI elements in Salesforce runs as the individual Box User.
Can I send generated documents for signature?
Yes. Select Available for Box Sign in the template's Settings step to make the template available for approval and signature.
Can I automate document generation?
Yes. Box for Salesforce includes Flow actions you can use in your own Salesforce Flows, including generating a document for a record and submitting and checking batches.
Troubleshooting
Document generation failed. What should I check?
- On the template's Tags tab, check Tags in Template for tags highlighted in red.
- On the template's Preview Payload tab, check that the data for an affected record looks as expected.
- If the template uses data sources, check each data source's Preview Payload tab, and make sure the data sources you need are active.
Images don't appear in my generated document, or generation fails.
- Check that the image tag is in the placeholder picture's alt text, not typed into the document body.
- Check that Mark as decorative is not selected for the placeholder picture. If it is, Word removes the alt text.
- Check that every
{{ for img in ... }}loop has its own placeholder picture and a closing{{ endfor }}tag. A missing{{ endfor }}causes generation to fail. - Check the template's Preview Payload tab to confirm the record has images and that the path in your alt text matches the data.
Related Articles