New in v0.104

Document Engine

Professional document generation built into Delivery Hub. Generate invoices, status reports, client agreements, and contractor agreements directly from your Salesforce data. Send PDF invoices via email with one click, track payments, and maintain a complete accounts receivable ledger — all automatically.

Key Features

Invoice Generation

Select an entity and date range, and the engine snapshots all work items, time logs, and rates into a frozen document record. Rates cascade: WorkRequest rate > WorkItem rate > Entity default rate. The snapshot is immutable — editing the source data after generation does not change the invoice.

PDF Rendering

Professional Visualforce-rendered PDF with company header, sold-to section, work items table, time log detail, A/R summary, and payment footer. Rendered server-side via Salesforce's Flying Saucer engine with inline styles for pixel-perfect output.

White-Label Branding

The PDF header, footer, and email automatically pull from the vendor NetworkEntity record. Any subscriber's vendor entity auto-brands their documents — zero configuration needed. Your company name, address, and contact info appear on every document.

Email Delivery

Send the invoice as a PDF email attachment with configurable CC. Status auto-transitions to Sent, and the due date is calculated from payment terms (Net 30, Net 15, or Due on Receipt). One click from preview to delivered.

Payment Tracking

Record payments against invoices with amount, date, and note. The engine auto-marks an invoice as Paid when payments fully cover the total. Prior balance auto-calculates from all unpaid invoices and carries forward to the next invoice.

A/R Summary

Each invoice includes an Accounts Receivable Summary table showing all unpaid prior invoices with period, amount invoiced, amount paid, outstanding balance, and status. Gives your client a complete picture of their account in every document.

Multiple Rate Support

Three-tier rate cascade — WorkRequest hourly rate overrides WorkItem billable rate, which overrides the Entity default rate. Different work items can have different rates on the same invoice, and the engine resolves each line item independently.

4 Document Templates

Invoice, Status Report, Client Agreement, and Contractor Agreement — all driven by DocumentTemplate__mdt custom metadata. Subscribers can add new templates without code changes. Each template defines its own fields, layout hints, and generation logic.

How It Works

Four steps from raw data to a paid invoice. The engine handles snapshotting, rendering, delivery, and reconciliation.

1

Generate

Click "Generate Document" on the entity record. Apex queries all WorkItems, WorkLogs, and WorkRequests for the entity and period, freezes everything into a JSON snapshot, and creates a DeliveryDocument__c record with a public access token.

2

Preview

The LWC viewer shows the document inline with a status badge, work items table, time log detail, and A/R totals. Review everything before sending.

3

Send

Click "Send Email." Apex generates the PDF via the Visualforce page, attaches it to an email, sends to the recipient with CC, and marks the document as Sent with a calculated due date.

4

Record Payment

Click "Record Payment" and enter the amount, date, and an optional note. The engine auto-marks the invoice as Paid when the payment covers the total, and reduces the prior balance on the next invoice.

Rate Cascade

Each line item on an invoice resolves its hourly rate through a three-tier cascade. The most specific rate wins.

WorkRequest Hourly RateHighest priority — set per request
WorkItem Billable RateFalls back if no WorkRequest rate
Entity Default RateFinal fallback — set on the NetworkEntity

Technical Details

The Document Engine is built entirely on native Salesforce — Apex controllers, Visualforce PDF rendering, Lightning Web Components, and Custom Metadata Types.

ComponentDetails
DeliveryDocumentController.cls770 lines, 8 @AuraEnabled methods (generate, send, payment, templates, status)
DeliveryDocumentPdfController.cls400+ lines, VF controller parsing JSON snapshots into typed wrapper properties
DeliveryDocumentPdf.pageVisualforce PDF template with inline styles (Flying Saucer compatible)
deliveryDocumentViewer LWCFull UI: generate form, preview, send modal, payment modal, PDF download
DocumentTemplate__mdt4 records out of the box — extensible via custom metadata, no code changes needed
DeliveryTransaction__cDedicated ledger object — multiple payments per invoice, 5 transaction types, 5 payment methods
Test Coverage21 test methods across 2 test classes

Payment & Transaction Ledger

Payments are not fields on an invoice — they are first-class records in a dedicated DeliveryTransaction__c object. This gives you a complete financial ledger with full audit trail.

Multiple Payments per Invoice

A single invoice can have any number of transactions. Record partial payments, split payments across methods (check + wire), or apply credits and adjustments independently. Each transaction is a separate record linked to the parent document.

Transaction Types

Five transaction types cover every billing scenario: Payment, Credit, Refund, Adjustment, and Write-Off. Each type affects the invoice balance calculation differently, and all are tracked in the A/R ledger.

Payment Methods

Record exactly how each payment was received: Check, Wire Transfer, ACH, Credit Card, or Cash. Payment method is stored on every transaction for reconciliation and reporting.

Automatic Paid Status

When the sum of payments on an invoice equals or exceeds the invoice total, the engine automatically marks the invoice as Paid. No manual status changes needed — the ledger is the source of truth.

Full A/R Audit Trail

Every transaction records the amount, date, method, type, and an optional reference note. The A/R Summary on each invoice reflects all transactions across all invoices for that entity — giving your client a complete account history in every document.

Also in This Release

Sync Fix: WorkLog Error Surfacing

The WorkLog ingestor now throws an explicit SyncException when the parent WorkItem cannot be resolved, instead of silently failing. This surfaces the error for retry and makes sync chain debugging significantly easier.

Activity Feed Dedup

Disabled redundant field tracking for stage changes. The dedicated Stage_Change handler already logs these transitions, so the generic field change tracker was creating duplicate entries. Cleaner activity feed with no information loss.

Ready to generate your first invoice?

The Document Engine is included in every Delivery Hub installation. No additional configuration required — just navigate to a Network Entity record and click Generate Document.