Document Table Template
The Document Table template creates header/line document structures similar to sales orders or invoices. This page explains how to configure document-style features.
When to Use Document Template
Use the Document template for:
- Transaction documents - Records with multiple line items
- Order-style data - Header information with detail lines
- Workflow documents - Records that move through stages
- Multi-line entries - Any data with header + details pattern
Examples
| Feature | Purpose | Pattern |
|---|---|---|
| Work Orders | Track work with tasks | Order + Lines |
| Expense Reports | Employee expenses | Header + Expense Lines |
| Internal Requisitions | Request items/services | Request + Lines |
| Quality Inspections | Inspection with checkpoints | Inspection + Check Lines |
Document Structure
Header Table
Contains document-level information:
- Document number (primary key)
- Dates
- Responsible person
- Status
- Totals
Lines Table
Contains line-level details:
- Document number (foreign key)
- Line number
- Item/description
- Quantities
- Amounts
Page Structure
- Document Page - Shows header with embedded lines
- Lines Subpage - ListPart embedded in document page
Creating a Document Feature
Step 1: Start Wizard
- Open Tasks > Create new features
- Click New Feature
- Select Document template
Step 2: Configure Document Identity
| Field | Description | Example |
|---|---|---|
| Feature Name | Internal identifier | "WorkOrder" |
| Table Caption | User-visible name | "Work Order" |
Step 3: Configure Number Series
Documents typically use number series:
- Auto-generated document numbers
- Sequential and unique
- Example: "WO-00001", "WO-00002"
Step 4: Configure Header Fields
The wizard creates standard header fields:
- No. (document number)
- Description
- Status
- Dates
Step 5: Configure Line Fields
Standard line fields:
- Document No. (link to header)
- Line No.
- Description
- Quantity
- Amount
Step 6: Complete Wizard
Click Finish to create header table, lines table, and pages.
Document Components
Header Table
Primary table for documents:
| Field | Type | Purpose |
|----------------|---------|-------------------|
| No. | Code | Document number |
| Description | Text | Document title |
| Status | Option | Open/Released/Posted |
| Document Date | Date | Creation date |
| Posting Date | Date | Accounting date |
| Assigned To | Code | Responsible person |
Lines Table
Detail table for document lines:
| Field | Type | Purpose |
|----------------|---------|-------------------|
| Document No. | Code | Link to header |
| Line No. | Integer | Unique line ID |
| Type | Option | Item/Resource/... |
| No. | Code | Item/Resource No. |
| Description | Text | Line description |
| Quantity | Decimal | Quantity |
| Unit Price | Decimal | Price per unit |
| Amount | Decimal | Line total |
Document Page
Card page with:
- Header fields in groups
- Lines subpage embedded
- Document actions
- FactBoxes (optional)
No standalone Lines list pages
The Document template auto-creates list pages for the header table — both posted and unposted — which support searching, filtering and analysing header records.
It does not create standalone Lines list pages showing all records across the lines table, the equivalent of Business Central's built-in "Sales Lines" and "Posted Sales Lines" pages.
Consequently there is no generated page for searching, filtering or analysing across all line records of a document feature. Lines are reachable only through the lines subpage embedded in each document page.
Auto-creation of standalone Lines list pages (posted and unposted) is a requested feature on the backlog, not available today.
Header-to-line defaulting is not supported
Automatically copying a header value into a newly inserted line — a header date defaulting into a line date while remaining editable — is not possible within the current scope of the Document feature. This is a hard limitation.
Excel and reports
- The line section offers Open in Excel (read-only export) only, not Edit in Excel. See Consuming APIs for why.
- Reports cannot currently be created or printed from a Document feature, and a print button requires an AL extension. See Data Table Template.
Adding Custom Fields
Header Fields
Add fields to the header table:
- Open Feature Card
- Access Feature Fields
- Add fields (applies to header)
Line Fields
Add fields to the lines:
- Access Line Fields configuration
- Add line-specific fields
Document Status Pattern
Documents typically have a status workflow:
Common Statuses
| Status | Meaning | Actions Allowed |
|---|---|---|
| Open | Being edited | All changes |
| Released | Ready for processing | Limited changes |
| Posted | Completed | No changes |
Status Transitions
Open → Released → Posted
↑ ↓
└───────┘ (Reopen)
Document Actions
Standard document actions:
| Action | Purpose |
|---|---|
| Release | Move to Released status |
| Reopen | Move back to Open |
| Post | Process and complete |
| Generate report |
Configuring Actions
Access Feature Actions to configure:
- Action name
- Status requirements
- Processing logic
Document Numbering
Number Series Setup
Documents use number series for auto-numbering:
- Configure number series in BC setup
- Link to your document feature
- Numbers generate automatically
Number series linkage is per company. The link between a number series and your feature lives in the SOD Setup page, and it applies per company. If you work in a different company from the one where it was configured, the automatic key will not populate.
If auto-numbering stops working:
- In Business Central press Alt+Q and search for the SOD Setup page — named "<Object Prefix> Customizations Setup", for example "SOD Customizations Setup"
- Re-link the number series to the feature for the current company
- Check the series itself: valid line with a Starting No., Last No. Used not at the Ending No., Default Nos. enabled
- Confirm Use Number Series is still on in the Feature Card
- Republish
See Data Table Template for the full number series behaviour.
Manual Numbering
Alternatively, allow manual entry:
- Users type document number
- Must be unique
- Good for external document references
Working with Documents
Creating a Document
- Open document list
- Click New
- Number is assigned (if using number series)
- Fill in header fields
- Add lines
Adding Lines
- In the lines subpage, click in a new row
- Enter line details
- Repeat for additional lines
- Lines save automatically
Processing Documents
- Review document is complete
- Release the document
- Perform any required processing
- Post when complete
Document Totals
Calculating Totals
Header typically shows:
- Line count
- Total quantity
- Total amount
FlowFields for Totals
Create FlowFields on header:
- Sum line quantities
- Sum line amounts
- Count lines
Document Patterns
Work Order Pattern
Header:
- Work Order No.
- Customer
- Description
- Status
- Scheduled Date
Lines:
- Task description
- Estimated hours
- Assigned technician
- Status
Expense Report Pattern
Header:
- Report No.
- Employee
- Period
- Status
- Total Amount
Lines:
- Expense date
- Category
- Description
- Amount
- Receipt attached
Internal Requisition Pattern
Header:
- Requisition No.
- Requested By
- Department
- Need By Date
- Status
Lines:
- Item/Service
- Quantity
- Unit Cost
- Total Cost
Best Practices
Header Design
- Include status for workflow
- Add date fields for tracking
- Include responsibility assignment
- Consider approval fields
Line Design
- Include clear line identification
- Support different line types
- Calculate line amounts
- Link to master data where appropriate
Page Layout
- Group header fields logically
- Position lines prominently
- Include relevant FactBoxes
- Provide clear actions