Example: Send a Rich Choice Response to a Customer With a Flow
In this example, you send product options using an autolaunched flow and rich choice response. You also help the agent decide whether to present text-based product options as buttons or a list.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions. Required add-on licenses vary by agent type. |
| User Permissions Needed | |
|---|---|
| To build and manage Service Agents: | Manage Agentforce Service Agents AND Manage AI Agents OR Customize Application |
| To open, edit, or create a flow in Flow Builder: | Manage Flow |
Before you begin:
- Create an Agentforce Service agent. If you want to use an active agent, create a version of it or deactivate it.
- Connect a service agent to an enhanced Messaging channel.
- If you haven’t worked in Flow Builder before, see Automate Tasks with Flows.
Create Product Records
Create a few active product records. Later, your agent uses information from these records in responses. Make sure that the agent user has access to the Product object and its fields.
For example, you can create product records with this information:
-
Product Name: Performance Tee
Product Description: Lightweight, moisture-wicking short-sleeve shirt designed for activity and comfort.
-
Product Name: Denim Jeans
Product Description: Modern jeans made with stretch fabric for maximum comfort and movement.
-
Product Name: Cotton Socks
Product Description: Durable, breathable ankle-length socks for everyday use. One size fits all.
-
Product Name: Crewneck Sweater
Product Description: Classic, soft cotton sweater for year-round casual wear. Available in six colors.
-
Product Name: Utility Jacket
Product Description: Water-resistant, hooded jacket with multiple pockets for practical outdoor use.
Create a Flow
To retrieve product records, create an autolaunched flow. Later, you create a custom agent action based on this flow. Make sure that the agent user has the Run flows permission.
- From Setup, in the Quick Find box, enter Flows, and then select Flows.
- Click New Flow and then select Autolaunched Flow (No Trigger).
-
In Flow Builder, create a productList resource with these properties.
- Data Type: Record. Select Allow multiple values (collection).
- Object: Product
- Availability Outside the Flow: Available for output
-
Create a recordId resource with these properties.
- Data Type: Text
- Availability Outside the Flow: Available for input
-
After the Start element, click
and then add a Get Records element with these properties.
- Label: Get Products
- Get Records of This Object: Select the Salesforce Object data source. From the Object dropdown, select the Product object.
- Filter Product Records: Select the None–Get All Product Records condition requirement.
- How Many Records to Store: All Records
- How to Store Record Data: Choose fields and assign variables (advanced).
- Select Variable to Store Product Records: The productList resource that you created.
- Select Product Fields to Store in Variable: Product Name, Product Description
- Save and activate the flow.
Create a Custom Agent Action
Create a custom agent action that uses the Get Products flow as a reference action.
- Reference Action Type: Flow
- Reference Action: Get Products
- Agent Action Instructions: Finds and retrieves product records. For each product, retrieve its name and description. This action is for when a user asks for products.
- Loading Details: Getting products
- recordId input instructions: The single ID of the Salesforce record with the product name.
- productList output instructions: A list of products. Select Show in conversation.
Create a Custom Subagent
Create a custom subagent that sends product options.
- Open your Agentforce Service agent in Agentforce Builder.
-
Create a custom
subagent with these properties.
- Classification Description: Handles inquiries related to searching for products, including gathering user requirements and presenting product options. For example, use this subagent when the user says: "What product do you have?"
- Scope: My job is only to assist customers with searching for products by gathering user requirements and presenting available product options based on user requests.
- Instructions: Use the Get_Products action to get product options.
Guide Agent Responses with Subagent Instructions
Add a subagent instruction that helps the agent decide how to present text-based product options.
- To encourage the agent to send options as buttons, tell it to present choices. For example: Present products in a clear, organized format with details like the description. Instruct the user to choose an option to see more details.
- To encourage the agent to send options as a list, tell it to not present choices. For example: Present products in a clear, organized format with details like the description. Do not ask the user to select or choose a specific product.
To test your agent, activate it and then chat with it on a connected channel.

