Section 2 · Prompt Engineering · 20% of exam
2.4 Grounding Techniques for Prompt Templates
Exam objective
Given a scenario, identify a suitable grounding technique for supplying relevant Salesforce or organizational context to a prompt.
Grounding adds trusted, relevant context to a prompt so the model can generate a response based on information connected to the task. Without grounding, a model may rely on general learned patterns and can return a plausible but unsupported answer. In Salesforce, grounding can use resources such as record fields, related lists, Flow outputs, Apex-provided values, Data 360 data, or retrieval results, depending on the template and feature.
Choose context that answers the question
Begin with the information the user actually needs. If a summary requires fields from the current record, merge fields can provide those values. If it needs related records, a related list or an appropriate Flow may supply them. If the answer depends on a collection of documents or knowledge articles, a data library or retriever can search and return relevant passages. The goal is not to add every available data source; it is to give the prompt the minimum sufficient evidence needed for its task.
Record-based grounding works well when the relevant facts are structured and attached to a known Salesforce record. Retrieval is more useful when the source is a larger body of text or documents and the system must find pertinent passages from a corpus. A retriever does not make a source authoritative by itself. The quality of the response depends on source accuracy, permissions, indexing, retrieval relevance, and instructions that tell the model how to use the supplied context.
Understand the resource path
Prompt Builder's resource picker can reference Salesforce resources, but a resource must be available to the template and invocation context. For example, a prompt that references a Flow output needs a compatible Flow and the required inputs. An Apex resource must expose the values the prompt needs. Data 360 grounding requires a suitable data model or retriever, along with correctly prepared and accessible data. Check that the selected resource supplies current values and that the template doesn't refer to an ambiguous field or stale text.
Grounding also intersects with security. Salesforce documents that retrieval from CRM data preserves standard role-based permissions when grounding data from a CRM instance, and the Einstein Trust Layer helps protect sensitive data in prompt processing. Still, the administrator must review which data is included, who can run the template, and what output can be shown or saved. Never assume a prompt can safely use a resource simply because the resource appears in a setup menu.
Test grounding, not just wording
Use representative records and questions. Inspect the preview to see what values or context are supplied. Test missing data, conflicting sources, long records, and a query with no relevant document. The prompt should instruct the model to stay within the provided facts, acknowledge when information is absent, and avoid inventing values. If retrieved content is irrelevant, improve the source, indexing, filters, retriever, or retrieval instructions rather than adding more generic prompt language.
Match the source to the information shape: fields for structured record facts, retrieval for finding relevant passages across a corpus, and Flow or Apex when a controlled calculation or transformation is needed.
Grounding improves relevance but does not guarantee factual correctness. Review both the source and the generated answer.
Extra concept: In retrieval-augmented generation, the retriever selects context and the prompt gives that context to the model; the model then generates a response. These are separate steps and can fail independently.
Official reference: Salesforce Help, Ground Prompt Templates with Salesforce Resources - https://help. salesforce.com/s/articleView?id=ai.prompt_builder_ground_template.htm&language=en_US&type=5
Key takeaways
- Ground prompts with relevant, authorized, current information.
- Choose structured fields or retrieval based on where the needed facts live.
- Test whether context is present, relevant, secure, and handled correctly when missing.
