Elements

Metrics, formulas, filters, and enrichments make up one library — the element library. Each is a reusable piece of context: define it once, add it by API name to any number of entities.

The four types

MetricFormulaFilterEnrichment
ProducesA rollup over related recordsA computed value from the recordA named, reusable conditionValues and/or record tables
CostBatched into one queryNone — no queryNone — it shapes queriesA query or more, per record
Default minimum levellistlist— (not rendered)detailed
Defined byRelationship + function + filtersA formula expressionConditions on the objectA source: Apex, invocable, or flow

Metrics, formulas, and enrichments put values on the payload. A filter never appears there. It belongs to the entity’s query contract: an agent passes its API name to Find Records and ContextWorks applies the condition. See Named filters.

Every element carries these properties:

PropertyWhat it holds
LabelWhat the payload calls the value
API nameHow entities refer to the element. You can’t change it after you create it
InstructionOptional. ContextWorks renders it with the value
SynonymsOptional
Minimum levelThe leanest level the element appears in
Available forWhich objects you may use the element on. Empty means any
Where usedThe entities that use it

Define once, use many times

One definition serves many entities. Change a metric’s filter and every entity using it returns the new result on its next call — no second copy to find, nothing to activate.

Entities are versioned; elements are not. A version freezes which elements an entity uses, never what they compute. An element’s edit dialog warns you when more than one entity uses it.

Add an element to an entity outside its Available for list and ContextWorks skips that element, logs a warning on the Issues page, and delivers the rest of the payload.

Metrics

A rollup over child records: count, sum, average, min or max, with optional filters. For example, SUM of Opportunities.Amount where IsClosed = false.

Metrics default to list level: one number answers how many or how much better than twenty-five rows. ContextWorks batches every metric on a payload into one query, so ten cost roughly what one costs. → Building metrics

Formulas

A standard Salesforce formula ContextWorks evaluates against the record it already loaded: Amount * Probability / 100. No extra query, and ContextWorks adds any field the expression names to the entity’s query for you. Percent fields evaluate as fractions, so 100% is 1.0. → Building formulas

Filters

A named condition you write once — open, committed — so an agent asking for open opportunities gets your definition of open rather than its own guess.

ContextWorks advertises each filter in the catalog with its meaning, and combines filters with AND in Find Records. A filter may use fields an agent can’t filter on individually, because you wrote the condition rather than the caller. See Named filters.

Enrichments

Computed context from a source:

SourceWhat it mounts
Apex ProviderA class implementing EntityEnrichmentProvider. Also how a Data 360 DTO registers
Invocable ActionAny existing @InvocableMethod, unchanged
FlowAny active autolaunched flow, unchanged
Data 360 (planned)Declarative queries over Data 360 objects
External Objects (planned)OData-backed __x objects

An enrichment returns labeled values or record tables. ContextWorks re-queries record results as the calling user. When a source fails, the payload still arrives without that enrichment, and the failure shows up on Issues. → Building enrichments · Provider SPI

Choosing between them

You want…Use
A count or total over child recordsMetric
Arithmetic over fields on this recordFormula
A business word agents can filter by — “open”, “committed”Filter
The actual child rowsRelated list — not an element
A value only your code can computeEnrichment (Apex provider)
Something an existing flow or action already returnsEnrichment (flow or invocable)
A parent record’s details inlineReference — not an element

If a metric and a formula could both produce it, prefer the formula — it costs no query.

What’s next

  • Domains — several entities under one name.
  • Levels — how deep a request goes.