Appearance
Exercise 3: Verify Customers with Hybrid Reasoning
In this exercise, you’ll create an Order Issues & Refunds subagent and add the actions it needs to support customer case lookups and refunds. In the next exercise, you’ll add customer verification guardrails using variables and conditional logic.
Step 1: Create the Get Customer Profile action
Create the Order Issues & Refunds subagent.
In Agentforce Builder, switch to the Canvas View.
Click the + sign besides Subagents in the explorer.
Select Create new subagent.
Set the following values:
Field Value Name Order Issues & RefundsDescribe the job you want the subagent to do This subagent resolves problems with orders, such as missing items, incorrect items, cold food, late deliveries, or orders that never arrived. It also handles support cases related to those issues—including creating a case, checking whether a case already exists, and providing case status/follow-up. It determines refund eligibility, issues refunds or credits, and explains outcomes clearly and empathetically to customers.Click Create and Open.
Paste the following into the Instructions Section:
txtAddress the user's concerns regarding their order. If the user reports an issue with their order, determine the nature of the issue (e.g., missing items, incorrect items, cold food, late delivery, or non-delivery).Click Save to save the changes.
Step 2: Create an action (Get Customer Profile)
Next, create an Apex-based action that retrieves customer details from an email address.
Open the Order Issues & Refunds folder in the explorer and select the subagent.
Click on the + sign besides Actions, and select Create new action.
Set the following values:
Field Value Name Get Customer ProfileDescription Retrieves a customer profile based on their email address.Click Create and Open.
Enter the following information:
Field Value Reference Action Type ApexReference Action Get Customer ProfileLeave the default input and output settings.
Click Save.
Step 3: Create the related cases action
Next, create an action that retrieves a customer’s related cases with basic case information.
Inside the Order Issues subagent, click on the + sign besides Actions, and select Create new action.
Set the following values:
Field Value Name Get Related CasesDescription Retrieves a customer’s related cases (basic details) based on the requested case status.Click Create and Open.
Enter the following information:
Field Value Reference Action Type ApexReference Action Get Related CasesOutputs - Cases Select checkbox Show in conversationClick Save.
Update the Get Related Cases Action Agent Script
In the Get Related Cases Action, Switch the current view from Canvas to Script.
Find the
Get_Related_Casesaction.Find the cases output and make the following changes:
- Update the output type to
list[object] - update the
complex_data_type_nameto@apexClassType/c__AgentCaseActions$CaseSummary
- Update the output type to
Click Save.
Step 4: Create the order refund action
Next, create an action that issues refunds using Flow.
Switch back to the Canvas view.
Inside the Order Issues Refunds subagent, Click on the + sign besides Actions, and select Create new action.
Set the following values:
Field Value Name Handle Order RefundsDescription Submits and executes order refundsClick Create and Open.
Enter the following information:
Field Value Reference Action Type FlowReference Action Issue RefundInputs - refundAmount Select checkbox Require Input to execute actionInputs - refundReason Select checkbox Require Input to execute actionInputs - verifiedContactId Select checkbox Require Input to execute actionOutputs - returnedRefunds Select checkbox Show in conversationClick Save.
Update the Handle Order Refunds Action Agent Script
In the Handle Order Refunds Action, Switch the current view from Canvas to Script.
Find the
Handle_Order_Refundsaction.Find the returnedRefunds output and make the following changes:
- Update the output type to
list[object] - update the
complex_data_type_nametolightning__recordInfoType
- Update the output type to
Click Save.
Step 5: Add actions to the Order Issues & Refunds subagent
Next, instruct the subagent how to correctly select each of the actions created.
Switch back to the Canvas view and open the Order Issues & Refunds subagent.
Add the following basic instructions to the subagent:
txtWhen a user asks about their order or requests a refund, ask for their email address. Run Get Customer Profile using the customer’s email address. Then either: - run Get Related Cases to check for existing cases and provide status, or - run Handle Order Refunds to process a refund when appropriate.Click Save.
Step 6: Test the agent
Next, test that the agent can ask for an email address, retrieve a customer profile, and show the customer’s open cases.
Click Preview.
Enter the following prompt:
txtCan you show me all of my cases?Press Enter on your keyboard.
When the agent asks for an email address, enter:
txtalex.morgan@example.comPress Enter on your keyboard.
In Interaction Details, confirm the agent runs Get Customer Profile and then Get Related Cases, and that it shows the case results in the conversation.
Summary
You have created the core actions your agent will use for customer support workflows, added them to Order Issues & Refunds with baseline instructions, and tested that the agent can retrieve and display open cases.