bcquality/custom/knowledge/mcp/api-page-flowfields-must-be-calcfields.md
Michael Dieringer dd5637b1db Custom-laget bestaar nu begge CI-checks: 72 validator-fejl -> 0
Normalisering af alle 39 custom knowledge-filer til READ-kontraktens
skema (validate_frontmatter.py + Test-KnowledgeIndex.ps1 begge groenne):

- R01/R02: 28 filer manglede frontmatter eller brugte aeldre skemaer
  (title/category/severity/rule-id m.fl.) - alle har nu praecis de 6
  kraevede noegler; keywords haandskrevet pr. fil da de driver
  worklist-selektionen i INDEX/knowledge-index
- R09: manglende Description-sektion - regel-agtige foersteoverskrifter
  (Core Rule/Rule/Regel/Core Principle) omdoebt, eller sektion indsat
  efter titlen hvor intro-tekst fandtes
- R10: fenced code blocks konverteret til 4-space indrykkede blokke
  i alle filer (indhold uaendret)
- R11: 4 filer over 100 linjer fortaettet redaktionelt uden semantisk
  tab (ai-eval-scores 143->100, git-lifecycle 121->97,
  permission-sets 113->99, test-feature-scenario-tags 105->91)
- R05: AL0197->al0197, add_repo->add-repo; keyword-lister trimmet
  til maks 10

Ingen regler er fjernet eller aendret i betydning - kun form.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 23:47:31 +02:00

2.1 KiB

bc-version domain keywords technologies countries application-area
all
mcp
api-page
flowfield
calcfields
odata
al
w1
all

CURABIS MCP: FlowFields on API Pages Rule Summary

Description

FlowFields on API pages must be explicitly calculated via CalcFields() in the OnAfterGetRecord trigger, or they return empty values in OData responses.

Key Points

Why it matters: "FlowFields are not stored in the database. Business Central only calculates them on demand." Regular pages auto-calculate during rendering, but API pages don't—external consumers receive raw empty values otherwise.

What to do: Every FlowField exposed in an API page's layout section requires inclusion in a CalcFields() call within OnAfterGetRecord. Multiple fields can be combined in one call.

What doesn't need it: Stored (non-FlowField) fields require no CalcFields processing.

Implementation Pattern

The provided example demonstrates proper implementation:

trigger OnAfterGetRecord()
begin
    Rec.CalcFields("Elapsed time (Chargeable)", "Customer Name");
end;

Verification Approach

Audit API pages by:

  1. Identifying every field bound to FlowField sources in the layout
  2. Confirming each appears in the OnAfterGetRecord CalcFields statement
  3. Flagging any missing FlowField as a defect (silent empty return to consumers)

This rule prevents data gaps in API integrations caused by overlooked calculation requirements.

BCApps Reference

BCApps API pages implement CalcFields() in OnAfterGetRecord for all FlowField-sourced fields. The BCPT Suite API page demonstrates the correct pattern for API pages with computed data.