# Grounding techniques: merge fields, flows and retrievers

*Agentforce Specialist Study Guide · Prompt Engineering · Last updated November 6, 2026 · https://www.certifyforce.com/study-guide/agentforce-specialist/prompt-engineering/grounding-techniques-merge-fields-flows-and-retrievers*

How to choose between record and related list merge fields, template-triggered prompt flows, Apex and Data 360 retrievers to ground a prompt template, and how to wire a retriever into a template, including activation, run-time search settings, dynamic pre-filters and citations.

- Certification: Salesforce Agentforce Specialist
- Exam section: Prompt Engineering
- Study guide: https://www.certifyforce.com/study-guide/agentforce-specialist

**Official exam objective:**

> Given a scenario, identify the appropriate grounding technique.

## What the exam expects

- Choose the grounding technique for a scenario: record merge fields, related list merge fields, a template-triggered prompt flow, Apex, or a Data 360 retriever.
- Explain why logic such as filtering, sorting or totals belongs in a flow or Apex resource, never in instructions asking the model to do it.
- Recognise when a prompt must search an indexed corpus for relevant passages and use retrieval-augmented generation (RAG).
- Wire a retriever into a template: create and activate it in AI Models, insert it, set search text, output fields and number of results, and use a dynamic pre-filter when the filter value is only known at run time.
- Key terms: **grounding** (adding relevant data to a prompt); **merge field** (a placeholder resolved with Salesforce data); **template-triggered prompt flow** (the flow type that returns prompt instructions to a template); **retriever** (searches a Data 360 search index and returns relevant content); **dynamic pre-filter** (a retriever filter whose value the template supplies at run time).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Insertable grounding resources | Record fields, flows, Apex, Data 360 DMOs, related lists | [Ground Prompt Templates](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_template.htm&language=en_US&type=5) |
| Merge field limits | 50 merge fields; 5 each for flow, Apex and related list merge fields | [Prompt Builder Limits](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_limits.htm&language=en_US&type=5) |
| Related list grounding | Fields from the page layout; no record-level filters; Activities unsupported | [Related List Merge Fields](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_related_list.htm&language=en_US&type=5) |
| Flow type for templates | Only Template-Triggered Prompt Flow; other flow types aren't available | [Flow Merge Fields](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_flows.htm&language=en_US&type=5) |
| Flow inputs | All flow inputs are required and must be present in the template | [Ground Prompt Templates](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_template.htm&language=en_US&type=5) |
| Apex resource | `@InvocableMethod`; returns `List<Response>` with a `Prompt` string | [Apex Merge Fields](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_apex.htm&language=en_US&type=5) |
| Retriever availability | Built in AI Models, then activated for Prompt Builder; one active version | [Retrieve Data](https://help.salesforce.com/s/articleView?id=data.c360_a_ai_retriever_about.htm&language=en_US&type=5) |
| Default retrievers | No longer created automatically with a new search index | [Retrieve Data](https://help.salesforce.com/s/articleView?id=data.c360_a_ai_retriever_about.htm&language=en_US&type=5) |
| Retriever Search Text | Free text or merge fields from globals and prompt inputs; 255-character limit; not related list, Flow or Apex | [About Retrievers](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_rag_about.htm&language=en_US&type=5) |
| Run-time filter value | Needs a retriever filter condition marked Dynamic, mapped in Pre-filter | [Prefilters](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_prefilters.htm&language=en_US&type=5) |
| Citations | Turned on in Template Settings; apply to all retrievers in the template | [Add Citations](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_retriever_citations.htm&language=en_US&type=5) |
| Retriever name in the UI | Einstein Search was renamed Retriever | [Ground with RAG](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_rag.htm&language=en_US&type=5) |

## Check yourself

- Why should an Apex prompt resource not assume every request-list entry contains data?
- When can a declared Apex input be absent from the prompt template?
- Why is a legacy `CapabilityType` not a universal prerequisite for an Apex merge field?

## Sources

- [Ground Prompt Templates with Salesforce Resources](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_template.htm&language=en_US&type=5)
- [Ground with Record Merge Fields](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_merge_fields.htm&language=en_US&type=5)
- [Grounding with Related List Merge Fields](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_related_list.htm&language=en_US&type=5)
- [Ground with Flow Merge Fields](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_flows.htm&language=en_US&type=5)
- [Grounding with Apex Merge Fields](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_apex.htm&language=en_US&type=5)
- [Ground with Knowledge Using Retrieval Augmented Generation](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_rag.htm&language=en_US&type=5)
- [About Retrievers in Prompt Templates](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_rag_about.htm&language=en_US&type=5)
- [Retrieve Data](https://help.salesforce.com/s/articleView?id=data.c360_a_ai_retriever_about.htm&language=en_US&type=5)
- [Customize Retriever Output with Prefilters](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_prefilters.htm&language=en_US&type=5)
- [Add Citations to Prompt Template Responses](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_retriever_citations.htm&language=en_US&type=5)
- [Enhance Agents with Business Knowledge Using RAG](https://trailhead.salesforce.com/content/learn/modules/retrieval-augmented-generation-quick-look/augment-prompts-with-relevant-knowledge)
- [Build a Field Generation Prompt Template](https://trailhead.salesforce.com/content/learn/modules/prompt-builder-basics/build-a-field-generation-prompt-template)
- [Create and Ground Prompt Templates](https://trailhead.salesforce.com/content/learn/modules/prompt-builder-basics/create-and-ground-prompt-templates)
- [Prompt Builder Limits](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_limits.htm&language=en_US&type=5)
- [Prompt Template Run-time Execution](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_runtime.htm&language=en_US&type=5)
- [Grounding with File Inputs](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_file.htm&type=5)
- [Add File Inputs to a Flex Prompt Template](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_add_file_flex.htm&type=5)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit and reading progress are included in the full study guide. The separate practice exams option includes the reviewed question bank and timed mock exams. The bundle includes both where available. See [current options and prices](https://www.certifyforce.com/pricing).
