CodamAIDocs
Topicdone

How CRMS finds the template

The order in which CRMS searches scopes and languages, why only published revisions count, and what the document says about where it came from.

Variants
USER before TENANT before SYSTEMLanguage with region, language, default variantNothing found

What this is about

A render request only names the key of the template, for example audit-report, and maybe a language. Which edition and which revision really renders is decided by CRMS. This search is called resolution.

The order

flowchart TB
    A["Request: key + language"] --> U{"USER edition<br/>of the person?"}
    U -->|"published in a<br/>fitting language"| OK["this revision renders"]
    U -->|"none, or nothing<br/>published"| T{"TENANT edition<br/>of the tenant?"}
    T -->|"published in a<br/>fitting language"| OK
    T -->|"none, or nothing<br/>published"| S{"SYSTEM edition?"}
    S -->|"published in a<br/>fitting language"| OK
    S -->|"none, or nothing<br/>published"| NF["404 template-not-found"]

Within every edition, CRMS tries the languages in this order:

The languages within one edition, using de-CH as an example
  1. 1
    CRMS
    the requested language exactly: de-CH
  2. 2
    CRMS
    only the language, without region: de
  3. 3
    CRMS
    the default variant of the edition, for example en
  4. 4
    CRMS
    if none of these variants has a published revision, it moves on to the next scope

If the request names no language, CRMS takes the language CIAS chose for the person, otherwise the default language of the installation. More in Language and time zone.

What is skipped

  • A scope the installation does not admit (CODAMAI_CRMS_TEMPLATE_SCOPES). If USER is switched off, CRMS does not look for person editions at all.
  • TENANT for a person without a tenant. There is no tenant whose edition could fit.
  • An edition without a published revision. If a person only has a draft or a revision in review, this does not break their reports. CRMS simply keeps searching.

Examples

The platform has audit-report with the variants de (default) and en. The tenant acme has its own edition with only de.

Who asksLanguageOwn USER editionWhat renders
Person at acmedenoneTENANT acme, variant de
Person at acmede-CHnoneTENANT acme, variant de (the region is dropped)
Person at acmeennoneTENANT acme, variant de, because de is the default variant there
Person at acmedeonly a draftTENANT acme, variant de. The draft does not count
Person at another tenantennoneSYSTEM, variant en
Person at another tenantfrnoneSYSTEM, variant de (default variant)

What the document says about where it came from

Every result names where it came from. Over REST, these details are in headers of the answer:

HeaderContentExample
Crms-Template-Keythe keyaudit-report
Crms-Template-Scopethe scope of the edition that wonTENANT
Crms-Template-Variantthe language of the variant that was usedde
Crms-Template-Revisionthe id of the revision0b7e…
Crms-Template-Revision-Hashthe chain hash of this revisionsha-256:9f86…

A final document keeps the same details for good, see Final documents.

Pitfalls

Next

Search