Appearance
Exercise 3: Extend Agents with Flow Actions - Part 2
This exercise builds upon the previous one. You'll create an alternative custom action that takes a collection of contacts as an input parameter to issue resort credits to multiple contacts with a single prompt.
Step 1: Examine the Issue Bulk Resort Credits flow
From Setup, open Flows.
Open the Issue Bulk Resort Credits flow.
Examine the flow. Here are some highlights:
The flow takes a collection of contact records (
contactRecords
) and the credit amount (amount
) as input parameters.First we loop through
contactRecords
, create acreditRecord
for each contact (including the contact and the amount), and add thecreditRecord
to thecreditRecords
collection.TIP
We create a collection of contact records to avoid invoking the Create Records action for each record. Always avoid performing database operations inside a loop.
Then we use the Create Records action to create the credit records using the
creditRecords
collection.Finally, we set the value of the
message
output variable and include the number of credit records created.
Click the back arrow button to leave Flow Builder and go back to Setup.
Step 2: Create the agent custom action
From Setup, open Agent Actions.
Click New Agent Action.
Configure the action as follows:
Field Value Reference Action Type Flow Reference Action Issue Bulk Resort Credits Agent Action Label Keep default Agent Action API Name Keep default Click Next.
Leave the default instructions in.
Check Require Input for both inputs (
amount
andcontactRecords
).Check Show in conversation for the
message
output.Click Finish.
Step 3: Add the action to your agent
From Setup, open Agents (under Agent Studio).
Click on Einstein Copilot in the list of agents.
Click Open in Builder.
In the Topics sidebar, click the CustomerServiceAssistant topic.
Click the This Topic's Actions tab.
Click the arrow down icon next to Issue Resort Credit, and select Remove from Topic.
Click the + button to add an action.
Check the Issue Bulk Resort Credits action and click Finish.
Step 4: Try it out
In the Conversation Preview panel, enter the following prompt:
txtIssue a $200 resort credit to Contacts in Chicago
Now, enter the following prompt:
txtList Contacts in Chicago
Take note of the name of one of the contacts. In the Coral Cloud app, search for that contact and open the corresponding contact record page.
TIP
The links don't work in development from Agent Builder.
Click the Related tab.
Scroll down and verify that you see the resort credit that you just issued.