Formulas
A formula is a standard Salesforce formula expression evaluated against the loaded record — a derived value the object doesn’t store. Use one when the number an agent should quote isn’t a field (weighted pipeline, days until renewal, margin), or when the stored field is stale or missing. No schema change, no deployment.
Define one
Studio → Formulas → New Formula
| Setting | Example |
|---|---|
| Label | Weighted Amount |
| API name | weighted_amount — generated from the label, fixed after creation |
| Expression | Amount * Probability |
| Return type | Currency |
| Instruction | Amount × probability. Not the same as Expected Revenue, which is set manually. |
Formulas use the same four element tabs — Details, Definition, Available For, Where Used. → Elements
Add it to an entity
A formula evaluates nowhere until an entity uses it. Two ways:
- The element’s Where Used tab
- + Add Formula on an entity’s canvas, under Core Record
If the canvas dropdown shows no available formulas, every applicable one is already added or none apply to this object — check Available For. In the payload, formulas render alongside metrics under Summary Metrics.
Write the expression
Standard Salesforce formula syntax, evaluated against the loaded record:
Amount * Probability
(Amount - Cost__c) / Amount
CloseDate - TODAY()
IF(IsClosed, "Closed", "Open")
Referenced fields are added to the query automatically — you don’t need to curate Probability for Amount * Probability to work. The field appears in the payload only if you also curate it.
WARNING
Percent fields evaluate as fractions: 100% is 1.0, not 100. Amount * Probability gives the weighted amount directly — no / 100. This is the most common formula mistake.
Set the return type
Number, Currency, Percent, Text, Boolean, Date, or Date/Time. It drives rendering — currency gets its symbol, dates get formatted — so set it correctly even when the arithmetic doesn’t care.
Restrict Available For
An expression is only valid on objects that have its fields — Amount * Probability works on Opportunity and nowhere else. Name those objects under Available For. An expression that can’t resolve its fields fails at render and leaves the agent quietly without a value; restricting up front turns that into a configuration error you can see.
Formula field or ContextWorks formula?
If the org already has a formula field on the object, curate it as a field — it’s queryable and reports can use it too. Use a ContextWorks formula when the value is only needed for agent context, you can’t or don’t want to add a field to the object, or the number is specific to how agents should read the record.
Formulas read fields already in memory, so they cost no query — which is why they default to list level and why a formula beats a metric whenever both could produce the number.
Error handling
An expression that can’t evaluate — missing field, type mismatch, division by zero — doesn’t break the payload. The formula is dropped and a structured issue is recorded on Issues. The failure is silent to the agent, so check the Issues page after adding one.