Generating Documents
This page explains how to generate documents from templates and save them directly to SharePoint from within Business Central.
Generation Overview
What Happens
When you generate a document:
- Select a record (e.g., Customer)
- Choose a template
- Report runs with record data
- Output is formatted (PDF/Word/Excel)
- File is uploaded to SharePoint
- File appears in FactBox
Prerequisites
To generate documents, you need:
- Table mapping for the record type
- Document template configured
- SharePoint connection active
Generating from the FactBox
Step-by-Step
- Open the record (Customer, Vendor, Job, etc.)
- Locate the FactBox on the right side
- Click "Generate Document" or similar action
- Select a template from the list
- Complete request page (if shown)
- Wait for generation to complete
- Verify in FactBox - file should appear
Visual Walkthrough
Customer Card: Contoso Ltd
├── [Details tab]
├── [Address tab]
└── [SharePoint FactBox]
├── Files: Quote.pdf, Contract.pdf
└── [Generate Document] ← Click here
└── Select: "Customer Statement"
└── Request Page (date range)
└── OK → Statement generated
Selecting Templates
When Multiple Templates Exist
If multiple templates are configured:
- Click Generate Document
- List of available templates appears
- Select the one you want
- Continue with generation
Template List Example
| Template | Description |
|---|---|
| Customer Statement | Monthly statement |
| Account Balance | Current balance report |
| Sales History | Sales transaction history |
Request Page Options
When Request Page is Enabled
If the template has "Show Request Page" enabled:
- Report's request page appears
- Set any required parameters
- Click OK to generate
Common Parameters
| Parameter | Purpose |
|---|---|
| Date filter | Limit to date range |
| Include details | Level of detail |
| Show balance | Include running balance |
Skipping Request Page
If "Show Request Page" is disabled:
- Report runs with default parameters
- Faster for standard documents
- Set parameters in template if needed
Output Location
Default Location
Documents are saved to:
- The record's main SharePoint folder
- Or the Optional Subfolder (if configured in the template)
Example Paths
| Record | Subfolder | Result |
|---|---|---|
| Customer: Contoso | (none) | /Customers/Contoso Ltd/Statement.pdf |
| Customer: Contoso | Statements | /Customers/Contoso Ltd/Statements/Statement.pdf |
| Job: Alpha | Reports | /Projects/Alpha/Reports/Quote.pdf |
File Naming
Dynamic Names
Generated files are named based on template configuration:
| Template Description | Generated Name |
|---|---|
Statement |
Statement.pdf |
Statement %1 |
Statement Contoso Ltd.pdf |
Statement %3 |
Statement 2024-01-15T14.30.45.pdf |
%1 Statement %3 |
Contoso Ltd Statement 2024-01-15T14.30.45.pdf |
Overriding the Name for a Single Run
The template picker includes a New Name field. Enter a value there to override the template's Description for that single generation run -- the template itself is not changed, and the next run uses the template's normal naming again.
Avoiding Duplicates
If a file with the same name exists:
- Check your naming configuration
- Use date/time placeholder (%3)
- Use unique identifiers
Generation Progress
During Generation
While generating:
- May see progress indicator
- Report processing
- Upload in progress
After Generation
When complete:
- FactBox refreshes
- New file appears in list
- File is ready to open
Generating Multiple Documents
Same Record, Different Templates
You can generate multiple documents:
- Generate Statement
- Generate Account Balance
- Generate Sales History
Each becomes a separate file.
Multiple Records
For multiple records:
- Generate from each record individually
- Or use batch operations for mass generation
Error Handling
Generation Errors
| Error | Cause | Resolution |
|---|---|---|
| Report error | Report has issues | Test report manually |
| No data | Record has no data for report | Check data exists |
| Permission | Can't write to SharePoint | Check permissions |
| Path error | Invalid folder path | Verify mapping |
Troubleshooting Steps
- Test report manually - Run report outside connector
- Check SharePoint - Verify folder exists and is accessible
- Check template - Verify configuration is correct
- Check connection - Test SharePoint connection
Best Practices
Effective Use
| Practice | Benefit |
|---|---|
| Use meaningful names | Easy to find files |
| Include dates | Version tracking |
| Use subfolders | Organization |
| Apply categories | Visual identification |
When to Generate
| Scenario | Action |
|---|---|
| Customer meeting | Generate statement beforehand |
| End of month | Generate monthly reports |
| Project milestone | Generate progress report |
| On demand | Generate as needed |
Integration with Other Features
Categories
Generated documents can have auto-assigned categories:
- Set in template configuration
- Appears immediately in FactBox
- Enables filtering and email attachment
E-Signing
After generation:
- Document appears in FactBox
- Select the document
- Send for e-signature
- Track signing progress
Metadata
If metadata mapping is configured:
- Metadata is populated on upload
- BC field values → SharePoint columns
- Enables SharePoint searching
Alternative: Auto-Upload
Difference from Templates
| Feature | Templates | Auto-Upload |
|---|---|---|
| Trigger | Manual action | Posting event |
| Documents | Any report | Posted documents |
| Control | User selects | Automatic |
Use templates for on-demand generation, auto-upload for posting automation.