Skip to main content
Stream TDX live on Salesforce+. Join virtual sessions and hands-on trainings to experience the future of software and learn how to build it.

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.

Note

To align with industry standards, Agentforce topics are now called subagents. Currently, this module uses the legacy term topic.

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

  1. From Setup, in the Quick Find box, search for and select Flows.
  2. From the All Flows list view, select the Get Customer Details flow to open it in Flow Builder.
  3. Click Deactivate to enable editing.
  4. Double-click the Get Contact by Email and Member Number element to open it.

Get Contact by Email and Member Number flow.

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

Lifetime_value__c field

  1. Select Save as New Version.
  2. Keep all defaults and select Save.
  3. Ensure you see Get Customer Details - V2 in the top banner, then click Activate.
Note

Any agent that uses the Get Customer Details flow is now using your new version. To preserve the flow's functionality for existing agents, you can save a modified flow as new flow.

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.

  1. From Setup, in the Quick Find box, search for and select Users.
  2. Click the EinsteinServiceAgent User username.
  3. At the top of the page, select Permission Set Assignments.
  4. Select Service Agent Permissions, then under Apps, select Object Settings.
  5. Scroll down, select Contacts, and click Edit.
  6. Find Lifetime_Value__c, and grant read access.

Read access granted to Lifetime_Value__c variable.

  1. 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

Note

Any topic can read and set agent variables. In Agentforce, variables are global, not specific to a topic.

  1. In the App Launcher, search for and select Agentforce Studio.
  2. Click CC Service Agent. Your CC Service Agent opens in Canvas view.
  3. To create a new version that you can edit, select New Version.
  4. In the Explorer panel, expand and select Variables.
  5. In the upper right of the Canvas, click New, then select Create Custom Variable.
  6. 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
  1. Click Create.

Your variable is created.

Lifetime_Value__c variable created.

Step 4: Populate the Variable with the User's Lifetime Value

For this step, you switch to Script view.

  1. In the Explorer panel, select the Experience Management topic and switch to Script view.
  2. Find the Get_Customer_Details reasoning action by searching for Get_Customer_Details: @actions.Get_Customer_Details.
  3. After the line with memberNumber = ..., paste the text set @variables.LifetimeValue = @outputs.contact.data.Lifetime_Value__c. Be sure you indent the text to match the previous two with instructions.

Lifetime_Value__c variable defined in Agent Script.

  1. 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.

  1. In the Explorer panel, select the Experience Management topic and switch to Script view.
  2. Find the Topic Selector topic by searching for Topic Selector.
  3. After the line with Select the best tool to call based on conversation history and user's intent., paste the text If 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.

Script view of instructions added to topic selector to rout to experience management when user supplies email and membership number

Now, switch back to Canvas.

Canvas view of instructions added to topic selector to route to experience management when user supplies email and membership number

Salesforce ヘルプで Trailhead のフィードバックを共有してください。

Trailhead についての感想をお聞かせください。[Salesforce ヘルプ] サイトから新しいフィードバックフォームにいつでもアクセスできるようになりました。

詳細はこちら フィードバックの共有に進む