Report Template Reference
Technical reference for report template configuration, field properties, and API endpoints.
For a conceptual overview of how report templates work, see Understanding Report Templates.
URL Patterns
# View report for a record
/apps/beta/{schema_name}/{record_id}/view
# Edit existing template
/apps/beta/ts_fnd_report_template/{template_id}/template-builder
# Create new template for a schema
/apps/beta/{schema_name}/-/template-builder
Template Configuration Structure
Templates are stored as JSON with the following structure:
interface ReportTemplateConfig {
version: 1;
pageSize: "A4" | "Letter";
orientation: "portrait" | "landscape";
margins: {
top: number;
right: number;
bottom: number;
left: number;
};
childSchemaName?: string; // Schema for line items
sections: {
header: { fields: FieldConfig[] };
body: { fields: FieldConfig[] };
footer: { fields: FieldConfig[] };
};
}
Field Configuration
interface FieldConfig {
id: string; // Unique identifier
type: "field" | "lineItemsTable";
schemaPath?: string; // For regular fields
label?: string; // Display label
columns?: ColumnConfig[]; // For line items table
showTotalsRow?: boolean; // For line items table
style: {
fontSize: "small" | "medium" | "large";
fontWeight: "normal" | "bold";
fontStyle: "normal" | "italic";
textAlign: "left" | "center" | "right";
};
}
Column Configuration
interface ColumnConfig {
schemaPath: string; // Field path in child schema
label?: string; // Column header
width?: number; // Column width (optional)
aggregation?: "none" | "sum" | "average" | "count" | "min" | "max";
style?: {
fontSize: "small" | "medium" | "large";
fontWeight: "normal" | "bold";
fontStyle: "normal" | "italic";
textAlign: "left" | "center" | "right";
};
}
Schema Requirements
Primary Schema
The primary schema provides header-level data. Any schema with a database.table property can be used.
Child Schema (Line Items)
For line items to work, the child schema must:
- Have a
database.tableproperty configured - Include a field with
foreign_key_ofpointing to the primary schema
Example child schema field:
{
"header_id": {
"type": "string",
"format": "uuid",
"foreign_key_of": "ts_far_customer_transaction_header"
}
}
API Reference
Fetch Templates
GET /db/v1/ts_fnd_report_template?schema_name=eq.{schemaName}&active=eq.true
Returns all active templates for a given schema.
Create Template
POST /db/v1/ts_fnd_report_template
{
"schema_name": "ts_far_customer_transaction_header",
"template_name": "Invoice Template",
"template_description": "Standard invoice layout",
"visibility": "PERSONAL" | "ORGANIZATION",
"template_config": { ... }
}
Update Template
PATCH /db/v1/ts_fnd_report_template?id=eq.{templateId}
{
"template_name": "Updated Name",
"template_config": { ... }
}
Generate PDF
POST /persist/v1/pdf-generate
{
"templateConfig": { ... },
"invoiceData": {
"header": { ... },
"lineItems": [ ... ]
}
}
Returns a PDF blob for download.
Template Visibility
| Visibility | Description |
|---|---|
| PERSONAL | Only visible to the template creator |
| ORGANIZATION | Visible to all users in the same organization |
Related Documentation
- Understanding Report Templates — conceptual overview
- Schema Reference — schema property documentation