Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
DictionaryGGrounding
AIAdvanced

Grounding

Grounding is the practice of injecting authoritative source data into a generative AI prompt at runtime, so the model produces its response from that data rather than from training memory.

§ 01

Definition

Grounding is the practice of injecting authoritative source data into a generative AI prompt at runtime, so the model produces its response from that data rather than from training memory. In Salesforce, grounding means a Prompt Builder template pulls record data, related records, knowledge articles, files, or Data Cloud entities into the prompt before the foundation model sees it. The model still generates the response with its language ability, but the facts come from the customer's org, not from the internet text the model trained on.

Grounding is the strongest single mitigation against hallucination. A well-grounded prompt drops the rate of fabricated answers from the 20 to 30 percent typical of ungrounded responses down to single digits for narrow tasks. Salesforce calls the runtime version dynamic grounding because the data is fetched per request, not baked into the template. The grounding step happens inside the Einstein Trust Layer, after PII masking and before the call out to the foundation model. Without grounding, every customer-facing GenAI feature is guessing.

§ 02

How grounding turns a guessing model into a Salesforce-aware one

Static versus dynamic grounding

Static grounding is text baked into the prompt template itself, like a policy paragraph or a tone-of-voice instruction. It is the same on every run. Dynamic grounding is data fetched per request, like the contact record for the case the agent is handling. Real Salesforce templates combine the two. Static text sets the constraints and persona. Dynamic merge fields and resource lookups supply the facts. The split matters because static text counts against the context window every time, while dynamic resources can be tuned to fetch only what the current task needs.

Record grounding, the most common pattern

Record grounding pulls the current record and its related records into the prompt. A case summary template grounds against the case, the related contact, the related account, and recent emails. The merge syntax in Prompt Builder looks like {!Case.Subject} or {!Related.EmailMessages}. The retrieval respects field-level security and sharing, so a user without access to a field sees the field absent from the prompt. Record grounding is the right default for transactional tasks where the answer lives in a known set of records.

Knowledge grounding for service surfaces

Service Cloud features ground against the Knowledge object. Reply Recommendations, Article Recommendations, and Case Summary all use semantic search against published knowledge articles to find the top relevant entries, then inject the snippets into the prompt. The search is vector-based, not keyword-based, so a customer question about returning a defective product matches an article titled refund policy even with no shared words. Knowledge grounding only works if the articles are published in the right channel and the right language. Draft articles are not retrieved.

Data Cloud grounding for cross-system context

When the answer needs context from outside Salesforce CRM (web behavior, billing system, support tickets in a separate tool), Data Cloud is the grounding source. The prompt template references a Data Cloud entity or calculated insight, and the runtime pulls the matching segment of unified profile data. This is how Agentforce sales agents see web visits, marketing engagement, and CRM history in the same prompt. Data Cloud grounding requires the data to be ingested, mapped, and unified in advance. It is not real-time scraping of external systems.

The retrieval step under the hood

For unstructured sources (knowledge articles, files, long records), grounding uses retrieval-augmented generation. The relevant text is chunked, embedded into vectors, and indexed. At runtime the prompt is embedded and the system returns the top-k most similar chunks. Salesforce manages this pipeline for native sources. For custom sources, Data Cloud's Search Index and Bring Your Own Model patterns let teams plug in their own embeddings or retrievers. The retrieval quality determines the grounding quality. Garbage in, hallucination out.

Context window limits and chunking

Every foundation model has a token limit. Stuffing the whole knowledge base or the whole account history into one prompt is not possible, and it is not helpful even when it fits. Models pay more attention to the start and end of the context than the middle. Grounding works best when the prompt template is selective: top 3 to 5 chunks, ranked by relevance, not the top 20. The chunking strategy matters too. Articles broken at headings ground better than articles broken at fixed character counts.

When grounding returns sparse or empty results

The hardest case is when the retrieval finds nothing relevant. The default behavior of most models is to generate fluent text anyway, drawing on training memory or making up plausible facts. The fix is to design templates that detect sparse grounding and short-circuit. A template that says if no knowledge article matches, return the string NOT_FOUND instead of generating an answer produces a clean failure mode that downstream code can handle. Hiding sparse-grounding behind a confident answer is how trust gets destroyed.

§ 03

How to ground a Prompt Builder template

Grounding is configured per template in Prompt Builder. The steps assume you already have a template in draft state with a clear task definition.

  1. Open the template in Prompt Builder

    Setup, Prompt Builder, open the template. The Resources panel on the right is where grounding sources live.

  2. Add the primary record resource

    Click Add Resource, pick Record, select the object (Case, Account, Contact). The merge syntax {!Input:Case.Subject} appears for fields you reference. Add only the fields the task needs.

  3. Add related records or knowledge

    For service templates, add Knowledge as a resource and configure the search query. For sales templates, add Related Records to pull child records like opportunities or contacts. For cross-system context, add Data Cloud entities.

  4. Preview with a real record ID

    Click Preview, paste a record ID, run. The preview shows the full grounded prompt and the model's response. Test with records that have thin context to see how the model handles sparse data.

  5. Activate and gate behind a permission set

    Activate the template. Create or update a permission set that grants Use Prompt Template on this specific template. Assign to a small pilot group before opening to all users.

Key options
Record groundingremember

Pulls fields from the current record and related records. Respects sharing and field-level security. The default for transactional tasks.

Knowledge groundingremember

Semantic search against published knowledge articles. Required for case summary, reply recommendation, and similar service features.

Data Cloud groundingremember

Pulls from unified profile data, including web behavior, marketing engagement, and ingested external data. Requires Data Cloud and a defined data graph.

File groundingremember

Pulls from attached files and Content libraries. Useful when the answer lives in a PDF or document rather than a record field.

Apex callable groundingremember

Custom Apex invocable that returns text. Used when the grounding source is an external system or a calculation. Counts against the context window like any other resource.

Gotchas
  • Context windows have token limits. Stuffing too much grounding dilutes the relevant context and degrades the response. Pick narrow, ranked grounding.
  • Grounding does not throw an error when the source is empty. The model just generates from memory. Always design a sparse-grounding fallback in the template.
  • Stale data grounds confident wrong answers. A knowledge article that has not been updated since the product changed is worse than no article. Audit knowledge freshness.
  • Field-level security applies to grounded record data. A user without read access on a field sees the field absent from their grounded prompt. Test with different profiles.
  • Knowledge articles in draft state are not retrieved, only published ones. The same article in two languages produces two retrievable entries.
§

Trust & references

Sources

Cross-checked against the following references.

Official documentation

Straight from the source - Salesforce's reference material on Grounding.

Keep learning

Hands-on resources to go deeper on Grounding.

Was this entry helpful?
Help us write better definitions. Quick reactions or detailed edit suggestions.

About the Author

Dipojjal Chakrabarti is a B2C Solution Architect with 29 Salesforce certifications and over 13 years in the Salesforce ecosystem. He runs salesforcedictionary.com to help admins, developers, architects, and cert/interview candidates sharpen their fundamentals. More about Dipojjal.

§

Test your knowledge

Q1. What is grounding in AI?

Q2. Why is grounding important?

Q3. What handles grounding for built-in Einstein features?

§

Discussion

Loading…

Loading discussion…