Publish a viewpoint Business Entity: a calculated, read-only business perspective over synchronized record tables. When you finish, Role Assistants and MCP can call governed read capabilities that return measures, dimensions, and grain you defined — not raw multi-entity lists from records search.
Business story: Viewpoints and joined business context.
Prerequisites
- Connected System with at least one synchronized
recordStorageentity (storageTypeomitted ortable) already validated and loaded - Concept understood: Viewpoints and joined business context
- Logged in (
aifabrix auth status) and able to validate / upload the system - Clear business contract: which questions, measures, dimensions, and row grain the Connected System owner will certify
Where it lives
One Business Entity JSON file under the integration package, listed in the application package alongside other datasources. Same Connected System systemKey as the source record entities.
Root markers that distinguish a viewpoint from a synced table entity:
| Field | Viewpoint value |
|---|---|
entityType |
recordStorage |
storageType |
view |
execution.engine |
cip |
| CIP fetch | source: viewpoint with SQL string in query |
source: record is local table I/O on a synced storageType: table (or omitted) entity. Do not use record on a viewpoint, and do not describe a viewpoint as local table persist.
A viewpoint is not a permanent database VIEW object and not a second synced copy of reporting data. Results are calculated when each read capability runs.
How to set
-
Design the business contract first — name the perspective (for example revenue by customer, actual cost by cost centre). Decide measures, grouping dimensions, and primary identity of each result row. The Connected System owner owns and certifies that meaning.
-
Add a new datasource file on the same Connected System. Set identity and storage:
{
"key": "example-crm-analytics",
"displayName": "CRM analytics",
"systemKey": "example-crm",
"entityType": "recordStorage",
"storageType": "view",
"resourceType": "record",
"syncBridge": "disabled",
"authority": false,
"primaryKey": ["externalId"],
"labelKey": ["customerName"]
}
Do not add inbound sync, webhooks, or create/update/delete CIP operations on a viewpoint.
-
Declare
metadataSchemaandfieldMappingsfor the result shape only (measures and grain fields the capability returns). Do not copy every source-entity column into the viewpoint schema. -
Declare
accessControl.abachonestly — either keep applicability on this perspective with a clear rationale, or marknotApplicablewhen policy remains on the underlying synchronized entities and document why. Prefer the same business-dimension keys the source entities use when the viewpoint must respect regional or cost-centre scope. -
Add CIP operations — one operation per business cut. Each enabled operation uses a read-only
SELECT(orWITH … SELECT):
{
"execution": {
"engine": "cip",
"cip": {
"version": "1.0",
"inputType": "void",
"outputType": "records",
"operations": {
"revenueByCustomer": {
"enabled": true,
"description": "Deal revenue and count per company",
"output": {
"type": "object",
"properties": {
"customerId": { "type": "string" },
"customerName": { "type": "string" },
"dealCount": { "type": "number" },
"revenue": { "type": "number" }
}
},
"steps": [
{
"fetch": {
"source": "viewpoint",
"query": "SELECT c.\"id\" AS \"customerId\", c.\"name\" AS \"customerName\", COUNT(d.\"id\") AS \"dealCount\", COALESCE(SUM(CAST(NULLIF(d.\"amount\", '') AS NUMERIC)), 0) AS \"revenue\" FROM records_example_crm_companies c LEFT JOIN records_example_crm_deals d ON d.\"primaryAssociatedCompanyId\" = c.\"id\" GROUP BY c.\"id\", c.\"name\""
}
},
{
"map": {
"useFieldMappings": false,
"inputPath": "$.items[*]"
}
},
{ "output": { "mode": "records" } }
]
}
}
}
}
}
SQL rules at save time:
- Exactly one statement
- Read-only
SELECT(orWITH … SELECT) — no insert/update/delete/DDL - Query physical synchronized record tables for source datasources (naming follows the platform records table for each source
key) - Prefer quoted identifiers matching published attribute / column names on those tables
-
Mirror each CIP operation in
capabilities[]with business-languagedescription,riskLevel, andapprovalRequiredas for other read capabilities. Keep OpenAPI disabled unless your package pattern requires otherwise. -
Register the file in the application package datasource list, then repair and validate:
aifabrix repair <systemKey> --dry-run
aifabrix repair <systemKey> --expose --rbac
aifabrix datasource validate <viewpointDatasourceKey>
aifabrix validate <systemKey>
- Upload and certify with the Connected System ladder. Re-run governance and trust pillars when the viewpoint contract or source entities change.
Defaults and examples
| Topic | Guidance |
|---|---|
storageType |
view required; omit or table for ordinary synced entities |
syncBridge |
Usually disabled — viewpoints do not participate as sync masters |
authority |
Usually false — preferred write/list authority stays on table entities |
| Operation keys | camelCase (revenueByCustomer), same pattern as other CIP ops |
| Sales cuts | Revenue by customer, pipeline by stage, activity by country |
| Finance cuts | Actuals / margin by cost centre and period under business-defined grain |
| Map step | Often useFieldMappings: false when SQL aliases already match the operation output |
Validate
aifabrix datasource validate <viewpointDatasourceKey>— must admit viewpoint SQL and reject mutations / sync-shaped ops.aifabrix validate <systemKey>then upload with probe as for other entities.- Invoke each capability as a scoped subject — confirm measures and grain match the certified contract.
- Confirm Role Assistants / MCP expose the business capability names, not SQL text.
- Confirm records search is still used for entity lists; do not expect multi-datasource search to replace these cuts.
Common mistakes
| Mistake | Fix |
|---|---|
Omitting storageType: view |
Set view before using fetch.source: viewpoint |
| Putting sync or write CIP on a viewpoint | Keep read-only calculated perspectives only |
Dumping all source fields into metadataSchema |
Model the result contract only |
| Multi-statement or mutating SQL | One read-only SELECT / WITH … SELECT |
| Expecting records search to return the same picture | Use viewpoint capabilities for measures and grain |
| Treating the viewpoint as a materialized reporting warehouse | It calculates when the capability runs |
Limits
Physical records table names, which authorization predicates the platform injects into viewpoint SQL, and bind-parameter support evolve with the platform release. Confirm behavior in your environment after validate/upload. Always keep the Connected System owner’s certified measures and grain as the business contract — the platform does not invent finance-approved KPI definitions for you.