Give Your Agent More Information with Flows, Actions, and Permissions
Learning Objectives
After completing this unit, you’ll be able to:
- Update an existing flow to return more information.
- Grant field-level permissions to your agent user.
Before You Start
Before you start this badge, make sure you complete this content. The work you do here builds on the concepts and work you do in that content.
Want to Get Hands-on with Agentforce?
We don’t have any hands-on challenges in this badge, but if you want to follow along and try out the steps, use the same Trailhead Playground that you created for Quick Start: Assemble a Service Agent with Agentforce Builder. The steps in this badge enhance the CC Service Agent that you created in the quick start. Here’s how to launch that Trailhead Playground. First, make sure you are logged in to Trailhead. Then click your user avatar in the upper-right corner of this page and select Hands-on Orgs from the dropdown. Click Launch next to the org you want to open.
Agentforce Determinism
Your CC Service Agent has been successfully helping customers explore and book experiences at Coral Cloud Resorts. Now you want to give it an additional responsibility: issuing resort credits to eligible loyalty program members.
Coral Cloud rewards high-value customers with credits to spend at their resorts. Because these rewards come at a cost, you want the agent to strictly follow your business rules to issue the correct number of credits to eligible customers only.
Enter Agentforce determinism! Agentforce gives you programming capabilities right in the Canvas, so you can create deterministic workflows that ensure your agent follows your business rules. You can use variables, conditional "if" statements, and action filtering to enforce specific agent behavior in certain situations. With determinism, your rules and data drive the agent’s path, while the LLM handles conversation and reasoning within that path.
Step 1: Configure Your Agent to Store the Customer's Lifetime Value
Coral Cloud Resorts stores a customer's lifetime value in a custom contact field, Lifetime_Value__c. You use that lifetime value to sort customers into Platinum and Gold tiers, so you can reward your best customers for their loyalty.
To share that information with the CC Service Agent, first, you update theGet_Customer_Detailsflow to return the lifetime value. Then, you grant permissions so the agent can see the custom field. Finally, you create an agent variable to store the customer's lifetime value.
Update the Get Customer Details Flow
- From Setup, in the Quick Find box, search for and select Flows.
- From the All Flows list view, select the Get Customer Details flow to open it in Flow Builder.
- Click Deactivate to enable editing.
- Double-click the Get Contact by Email and Member Number element to open it.

- Click Add Field.
- In the Search fields… box, select Lifetime_Value__c.

- Select Save as New Version.
- Keep all defaults and select Save.
- Ensure you see Get Customer Details - V2 in the top banner, then click Activate.
Now, the flow will return the customer's lifetime value to the agent. Let's give the agent permission to read that value!
Step 2: Grant the Agent User Permissions to LifetimeValue__c
Salesforce protects your data like Fort Knox—users don't automatically have access to an object's custom fields. Let's give your agent user permissions to see the custom LifetimeValue__c field.
- From Setup, in the Quick Find box, search for and select Users.
- Click the EinsteinServiceAgent User username.
- At the top of the page, select Permission Set Assignments.
- Select Service Agent Permissions, then under Apps, select Object Settings.
- Scroll down, select Contacts, and click Edit.
- Find Lifetime_Value__c, and grant read access.

- Click Save.
Your agent can now see a customer's lifetime value. Next, let's create an agent variable to store the lifetime value.
Step 3: Create the LifetimeValue Variable
- In the App Launcher, search for and select Agentforce Studio.
- Click CC Service Agent. Your CC Service Agent opens in Canvas view.
- To create a new version that you can edit, select New Version.
- In the Explorer panel, expand and select Variables.
- In the upper right of the Canvas, click New, then select Create Custom Variable.
- Use these values to create your variable:
- Name and API Name:
LifetimeValue - Data Type: number
- Description:
The value of Lifetime_Value__c from the Contact record.
- Default value:
0
- Click Create.
Your variable is created.

Step 4: Populate the Variable with the User's Lifetime Value
For this step, you switch to Script view.
- In the Explorer panel, select the Experience Management topic and switch to Script view.
- Find the Get_Customer_Details reasoning action by searching for
Get_Customer_Details: @actions.Get_Customer_Details.
- After the line with
memberNumber = ..., paste the textset @variables.LifetimeValue = @outputs.contact.data.Lifetime_Value__c. Be sure you indent the text to match the previous twowithinstructions.

- Click Save, then switch back to Canvas view.
Now your agent stores the customer's lifetime value when it fetches the customer record.
Step 5: Help Your Agent Find the Right Topic
When your customer replies with their email address, you want to be sure that the agent understands that the customer is being verified, not just chatting.
- In the Explorer panel, select the Experience Management topic and switch to Script view.
- Find the Topic Selector topic by searching for
Topic Selector.
- After the line with
Select the best tool to call based on conversation history and user's intent., paste the textIf the customer is providing their email and
| and membership number, run {!@actions.go_to_Experience_Management}.
You've created this instruction to help the agent route correctly.

Now, switch back to Canvas.

