# Grounding techniques: merge fields, flows and retrievers

*Agentforce Specialist Study Guide · Prompt Engineering · Last updated October 15, 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 unstructured, high-volume or frequently changing content as a retrieval-augmented generation (RAG) job.
- 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 is a related list merge field the wrong choice for "comments from the last 30 days"?
- When should Apex be preferred to a flow as a grounding resource?
- Why can't a template author find a newly built retriever in Prompt Builder?
- Which flow type can ground a prompt template?

## 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)
- [Enhance Email Campaigns with 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)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 9 linked practice questions, and unlimited timed mock exams are included with the Agentforce Specialist pack (USD $19): https://www.certifyforce.com/practice-exams
