Metrics
A metric is a rollup over related records — count, sum, average, min, or max — that reaches the agent as one labeled number instead of the rows behind it. When the question is how many or how much, “Open Pipeline: $40,000” beats twenty-five rows the agent has to add up.
Create one
Two ways, both writing to the same shared element library:
- From the entity builder — click + Add Metric on the canvas. The pickers cover only the object you’re on.
- From the Metrics page — Studio → Metrics → New Metric. Use this for a metric that serves several entities, or to edit one already in use.
A metric you create on the canvas saves to the library immediately, unlike other builder edits. Adding it to the entity still waits for your Save.
Define it
| Setting | Example |
|---|---|
| Over Related List | Opportunities |
| Label | Open Pipeline |
| Function | Sum |
| Field | Amount |
| Filters | IsClosed equals false |
| Instruction | Open, unweighted. Excludes closed-lost. |
Function is Count, Sum, Average, Min, or Max; Count needs no field. Filters make a metric meaningful. “Opportunity Count” is trivia; “Open Opportunity Count” is a signal. → Filters
Write an instruction for almost every metric. A number without its definition is ambiguous. → Instructions
Unnamed relationships
Lookups without a named child relationship appear in the picker as “Children — via Field Name”. The metric stores the child object and foreign key explicitly. They work the same as named relationships; you just can’t refer to them by relationship name.
The four tabs
On the Metrics page, you edit a metric across four tabs:
| Tab | What’s there |
|---|---|
| Details | Label, API name, instruction, minimum level |
| Definition | The relationship, function, field, and filters |
| Available For | Which objects this metric may be used on |
| Where Used | Which entities currently include it |
Available For constrains by object; Where Used then offers only entities on those objects. Name exactly one object and the Definition tab offers relationship and field dropdowns from that object’s schema, rather than free-text entry.
Set the minimum level
Metrics default to list and render at every level. ContextWorks batches every metric on a payload into a single aggregate query, so ten cost roughly what one costs. Raise the minimum when a metric only matters in depth, or lean payloads are getting crowded. → Levels
WARNING
Below its minimum level, ContextWorks skips a metric silently — no warning, no logged issue. A missing metric is nearly always a level or Available For mismatch.
Edit a shared metric
You define a metric once and add it to any number of entities. Editing it changes every entity that uses it, and the modal warns you when the change reaches more than one. If two entities need different definitions, make two metrics with distinct names; don’t fork one by editing it back and forth.
Metric, related list, or formula?
| The agent needs | Use |
|---|---|
| To know how many, or how much | Metric |
| To reason about individual rows | Related list |
| Arithmetic over this record’s own fields | Formula — no query cost |
Pairing a metric with a related list is often the best shape: “Open Cases: 34” alongside the five most recent. If a formula could produce the number, prefer it. Amount * Probability is a formula; SUM of child Opportunities must be a metric.