Adding Context Fields
How to Add a Context Field
-
Open the Agent Definition
Navigate to the REDA AI app and open the Agent Definition you want to configure.
-
Find the Context Fields Related List
Scroll down to the "Context Fields" related list showing currently configured fields.
-
Click "New Context Field"
Click the "New" button to create a new context field record.
-
Select Object API Name
Enter the Salesforce object type (e.g., "Opportunity", "Account", "Contact"). This is the API name, not the label.
-
Enter Field API Names
Enter all the fields you want this configuration to load, as a comma-separated list of API names — for example
StageName, Amount, CloseDate. One configuration record carries the whole list; you do not create a record per field. Find the API names in Setup → Object Manager → Fields. -
Set Max Fields (Optional)
Caps how many fields this configuration may contribute. Defaults to 10 — raise it if your list is longer, and remember every field costs tokens on each turn.
-
Leave Include Related Names on (recommended)
On by default. Lookup fields then contribute the related record's name instead of its raw Id, so the agent reads "Acme Properties" rather than an 18-character key.
-
Add a Context Description (Optional)
Free text telling the agent what this record context represents and how to use it — useful when field names alone don't convey the business meaning.
-
Set Sort Order (Optional)
Controls the order configurations are applied when more than one matches. Lower numbers first; the packaged default is 100.
-
Record Type Restriction (Optional)
If this field should only load for a specific record type, select the record type. Leave blank for all record types.
-
Save the Context Field
Click Save. The field is now configured for this agent.
Finding Field and Object API Names
Context fields require API names, not labels. To find them:
- Go to Setup → Object Manager
- Find the object (e.g., "Opportunity")
- Click "Fields & Relationships"
- Find the field you want (e.g., "Stage")
- Click the field to open its details
- Look for "Field Name" or "API Name" — this is what you enter in context fields
- Example: The label "Stage" has API name "StageName"
Common API names vs. labels:
| Object | Label | API Name |
|---|---|---|
| Opportunity | Stage | StageName |
| Close Date | CloseDate | |
| Expected Revenue | ExpectedRevenue | |
| Account | Account Name | Name |
| Annual Revenue | AnnualRevenue | |
| Number of Employees | NumberOfEmployees | |
| Case | Status | Status |
| Priority | Priority | |
| Description | Description |
Context Field Configuration Fields
| Field | Required? | Description |
|---|---|---|
| Agent Definition | No (optional) | Which agent this context field applies to. Leave blank for universal context fields. |
| Object API Name | Yes | The Salesforce object (e.g., "Opportunity", "Account"). Use API name, not label. |
| Field API Name | Yes | The specific field (e.g., "StageName", "Amount"). Use API name, not label. |
| Max Fields | No | Caps how many fields this configuration contributes. Default 10. |
| Include Related Names | No | On by default — lookup fields contribute the related record's name rather than its Id. |
| Context Description | No | Free text explaining to the agent what this record context represents and how to use it. |
| Sort Order | No | Number controlling the order fields are presented to the AI. Lower numbers come first. Default: 0. |
| Record Type Restriction | No | Optionally limit this context field to a specific record type. Leave blank to apply to all record types. |
Three rules the field labels do not tell you.
- Max Fields is clamped to 1–25 at run time. The default is 10. Enter 40 and the agent still gets 25; enter 0 and it gets 1. The value is not rejected on save, so a config asking for 40 looks like it is working while quietly delivering 25.
- Sort Order is the last tiebreaker, not the first rule. Agent-specific beats universal, and record-type-scoped beats unscoped, before Sort Order is considered at all. It only orders configurations that are otherwise tied. A universal config with Sort Order 1 still loses to an agent-specific config with Sort Order 100.
- Record Type Developer Name is the DeveloperName, not the label. If the record type shows as “Commercial Lease” in Setup, the value here is likely
Commercial_Lease. A label typed in by mistake simply never matches, and the configuration silently never activates.
At most 50 configurations are considered for one object in a single turn. That is far above any sane setup, but it is the ceiling.
Universal Context Fields
To create a context field that applies to ALL agents (universal):
- Leave the Agent Definition lookup blank (don't select an agent)
- Fill in Object API Name and Field API Names as usual
- Save
This context field now applies to all agents for that object type, unless overridden by agent-specific context fields (which have higher priority).
Testing Context Fields
After adding a context field:
-
Open a Record in Salesforce
Open a record of the object type you configured (e.g., an Opportunity if you added context fields for Opportunity).
-
Activate the Agent Chat
Open the REDA AI chat widget on the record page.
-
Ask a Question About the Record
Ask something like "What's the stage of this opportunity?" or "Tell me about this deal."
-
Verify Context Fields Appear in Response
The AI should mention the field values from your context fields. If it does, the context fields are working.
-
Check Logs (Optional)
If you have access to conversation logs or debug information, verify that the context field data was included in the AI's context.
Best Practices for Context Fields
Add 3-5 context fields initially and test. Monitor token usage and adjust. Add more fields only if the AI needs them and tokens are within budget.
Explain the context, not the field names — The agent reads the field API names directly, so use Context Description to convey what the record represents and how to use it (e.g. "This is an active lease; Amount is the monthly rent, not the contract total"). That carries far more meaning than renaming individual fields.
Order the fields in the list — Fields are presented to the agent in the order you write them in Field API Names, so put the most important first. Sort Order applies between whole configuration records, not between fields inside one.
Leverage Record Type Restrictions — If you have different record types with different fields, use Record Type restrictions to tailor context fields per type.
Monitor Token Usage — Each context field adds tokens. After adding context fields, monitor your credit consumption and adjust if costs increase unexpectedly.
Removing Context Fields
To stop using a context field:
- Open the Context Field record
- Click the Delete button
- Confirm the deletion
The field is immediately removed from the agent's context. The AI no longer has access to that field on record pages.
Common Context Field Sets
- Sort 1: AccountName (Account lookup related field)
- Sort 2: StageName (current deal stage)
- Sort 3: Amount (deal value)
- Sort 4: CloseDate (expected close)
- Sort 5: Probability (forecast confidence)
- Sort 1: CaseNumber (reference)
- Sort 2: Status (open/closed)
- Sort 3: Priority (urgency)
- Sort 4: Description (issue summary)
- Sort 5: CreatedDate (when reported)
- Sort 1: Name (account name)
- Sort 2: Industry (industry type)
- Sort 3: AnnualRevenue (company size indicator)
- Sort 4: BillingCity (location)
Frequently Asked Questions
Yes. Any field accessible via the Salesforce API can be added as a context field. Formula and roll-up fields are included — just enter the field's API name exactly as it appears in Object Manager.
If a field is empty for a record, the AI sees it as empty. The AI handles missing data gracefully — it won't break the conversation. Optional fields are fine to include.
Token consumption increases with more fields. A good guideline: 5-10 fields per object. Use the Context Field Optimizer to identify the most valuable fields and remove rarely-used ones.
No. Context fields only load on record detail pages. On list views or home pages, the AI doesn't have a specific record context, so context fields are not loaded.
Runtime Considerations
The platform applies two safety mechanisms when loading context at runtime that you should know about when configuring context fields:
- Polymorphic relationship handling. Lookup fields with multiple possible target objects (e.g.
Task.WhoId,Task.WhatId) include the lookup Id in context but skip the auto-Name expansion that single-target lookups get. See Polymorphic Relationships. - Strict vs degraded mode. By default, if any configured context field becomes inaccessible (deleted, renamed, or blocked by field-level security (FLS) for the running user), the agent run aborts. The agent-level Allow Degraded Record Context flag flips this to fail-open: the platform logs a warning and continues with whatever fields it could load. Pick strict for internal agents needing complete context; pick degraded for customer-facing or API-driven agents that should gracefully tolerate missing fields.
Next Steps
Use the Context Field Optimizer to get AI-powered recommendations, learn how the runtime handles polymorphic relationships, or explore context suggestions for quick-action buttons.