BLOG

How to Create and Configure a Service Agent in Salesforce Agentforce?

• Date: November 2024 •
Estimated reading time: 9 minutes
Salesforce Developer at Twistellar
Subscribe for more useful content
We promise we'll not spam your mailbox!
By submitting you agree to receive a newsletter from Twistellar. You can unsubscribe anytime.
Since its release in October 2024, Agentforce has been proclaimed a huge CRM milestone with its turnkey AI Service Agents. While the official demos for Salesforce Agentforce look easy, there are unobvious configuration pitfalls that can lead to incorrectly functioning Agents or prevent you from creating one without specific configurations.
Following our recent article with Agentforce features overview, we’ve compiled an easy-to-follow, straightforward guide to building an Agentforce Service Agent. It will have a simple flow for creating a case after a customer request via a website chat.
Steps one to five outline the Service Agent creation, and steps six to ten describe how to embed and launch it for your customers to see and interact with.

How to Сreate a Service Agent in Salesforce?

Before building an Agent, make sure you have Einstein, Einstein Bots, Agents, Embedded Service Deployment, and Messaging enabled:
  1. Click the gear icon in the upper right corner, select Setup.
  2. In the Setup Quick Find on the left pane, search for and select Einstein Setup. Toggle Turn on Einstein.
  3. Search for and select Einstein Bots. Toggle Einstein Bots to ensure it is on.
  4. Search for and select Agents. Toggle Einstein Copilot for Salesforce to ensure it is on.
  5. Refresh your browser to reload Setup.
You can try all of the steps in a demo Trailhead Salesforce org. Now, let’s proceed to create a Service Agent.

  1. Create an Autolaunched Flow

To outline the order of actions Agent will take, let’s start by creating an Autolaunched Flow with input fields to create a сase (OpenFlow Builder—Setup—Quick Find box, find and select Flows—New Flow).
The flow should check for a contact in the system and create a new case. If necessary, you can simplify this step by removing the contact check. Here’s what it will look like:
create an autolaunch flow #1 - agentforce
create an autolaunch flow #2 - agentforce
Autolaunched Flow for Service Agent in Salesforce, image source: Trailhead
Create the following fields in this flow to make sure it relays all the necessary information about the case to your Salesforce org:
  • Variable with API Name = caseRecord, Data Type = 'Record', Object='Case' and enable 'Available for output'
  • Variable with API Name = contactRecord, Data Type = 'Record', Object='Contact' and enable 'Available for input'
  • Variable with API Name = caseDescription, Data Type = 'Text' and enable 'Available for input'
  • Variable with API Name = caseSubject, Data Type = 'Text' and enable 'Available for input'
Save and activate your flow.

2. Create an Agent Action

Next, click the New Agent Action button to create an Agent Action to connect the flow with the Agent in Setup—Agent Actions. You can also use a preexisting Create Case action, but creating an Action from scratch is better if you switch dependent flows.
create a salesforce agent action
create a salesforce agent action #2
create a salesforce agent action #3
Salesforce Service Agent Actions Settings, image source: Trailhead

3. Create an Agent

Let’s create an Agent which will execute the flow and the action above (Setup—Agent (Agent Studio)—New Agent).
create an agent in salesforce
Creating an Agent in Salesforce, image source: Trailhead
Select its type (Service Agent) and proceed to review and add the topics. For this Agent, we need to add Case Creation and Escalation ones.
create an agent in salesforce #2
Selecting Topics for a Service Agent in Salesforce, image source: Trailhead
Define the settings for the Agent.
create an agent in salesforce #3
Service Agent Settings in Salesforce Agent Builder, image source: Trailhead
You can add data for the knowledge articles in the next step, but it's unnecessary for this specific Agent.

4. Manage Permissions

In Setup—Agent Details, you can see an autogenerated user for this specific Agent that requires the Permission set.
manage permissions - agentforce
Salesforce Agentforce Service Agent Details, image source: Trailhead
Create a permission set and assign it to the Einstein Service Agent User. A custom permission set should give read access to all fields in the Contact object and read/create/edit permissions for the Case object. We also need to grant edit access to all fields for the Case object.
Below are the permissions you will have to configure for the said user to administrate the Agent (Setup—Quick Find box—Permission Sets). Without the Permission Set, the Agent won’t be able to create and proceed with cases.
Permission Set for the Agentforce Service Agent in Salesforce
Permission Set for the Agentforce Service Agent in Salesforce, image source: Trailhead
Here’s how your Agent looks in Agent Builder. You can review the instructions inside the topic for relevance. For example, if the customer is not identifiable otherwise, make sure the Agent asks for the customer's email address to attach to the case.
You can test your Agent in the Conversation Preview pane. At this stage, it’s only available to you as an admin user.
Salesforce Agent Builder
Salesforce Agent Builder, image source: Trailhead

5. Add the Action to the Agent

 Add the ‘Create Case’ action from Step 2 to the Agent. Deactivate the Agent in the Agent Builder, then switch to the tab ‘This Topic’s Actions,’ click New, and choose ‘Add from Asset Library’ to add the Action created in step 2.
salesforce agent builder - agentforce service agent
Salesforce Agent Builder – Topic’s Actions, image source: Trailhead
Adding Actions for Agentforce Service Agent
Adding Actions for Agentforce Service Agent, image source: Trailhead

6. Create a Messaging Queue

Before the next step, please make sure to activate your Agent in Agent Builder.
Next, let’s create a Messaging Queue to manage the order in which the cases will be assigned to appropriate Agents in Setup—Queues. Later, the created instances will be assigned to this queue for processing.
messaging queue for service agent in salesforce
Messaging Queue for Service Agent in Salesforce, image source: Trailhead

7. Create an Omni-Channel Flow for Case Routing

Let’s create an Omni-Channel Flow to control routing settings in OpenFlow—Builder—Setup—Quick Find box, find and select Flows under Process Automation.
Click the All + Templates tab. In the left pane, select Omni-Channel Flow. Edit the template to reflect your routing preferences. You can customize the flow to route chats, messages, or cases to Agents.
In this flow, create a Variable with API Name = recordId, Data Type = 'Text,' and Enable 'Available for input’. These parameters are necessary for the session with the customer to be searchable within the system.
Then, add a Route Work action to route the work item. This action is the last object in the flow. Save your flow and activate it.
set up a messaging channel in agentforce
Salesforce Omni-Channel Flow for Case Routing for Service Agent, image source: Trailhead

8. Set Up a Messaging Channel

To make sure customers have a way to interact with a Service Agent, let’s create a Channel in Setup—Messaging Settings—New Channel.
For now, choose Messaging for In-App and Web for your customers to contact the Agent on the website. Ensure the channel is active.
set up a messaging channel in salesforce
setting up a messaging channel for salesforce service agent
Setting Up a Messaging Channel for Salesforce Service Agent, image source: Trailhead
Pay close attention to the Omni-channel routing settings pane because they define which Agent is linked to this messaging queue.
setting up a messaging channel for salesforce service agent
Setting up a Messaging Channel for Salesforce Service Agent, image source: Trailhead
A channel cannot be assigned to multiple Agents, but a single Agent can be assigned to various channels. This way, you can distribute the load between the Agents according to their primary tasks, like customer support, order placement, etc., and avoid confusion.
Make sure the messaging channel is active before proceeding.

9. Create Embedded Service Deployment

Next, let’s create an Embedded Service deployment (Setup—Embedded Service Deployment) that will utilize the messaging channel connected to the Agent. Basically, it is a link between the customer-facing chat and your Agent.
create embedded service deployment for salesforce service agent
Create Embedded Service Deployment for Salesforce Service Agent, image source: Trailhead
You must specify the domain where the interaction will take place and the messaging channel created earlier in step 8.
Create for Salesforce Service Agent
Create Embedded Service deployment for Salesforce Service Agent, image source: Trailhead
For reference, here’s where you can find your domains for Embedded Service Deployment (Setup—All Sites):
domains for embedded service deployment salesforce
Domains for Embedded Service Deployment Salesforce, image source: Trailhead
In the next step, ensure the Web Deployment is Active and published. On this screen, you can review the settings and branding features if you have any, as well as pre-chat forms in case you ask for a name or other info before chatting. Hit the Publish button every time you make a change. Keep in mind that it might take up to 10 minutes to apply your changes.
salesforce embedded service deployment
Salesforce Embedded Service Deployment, image source: Trailhead

10. Deploy the Chat Feature on your Website

To deploy the chat on your website, go to Setup—All Sites—Builder, and add the Embedded Messaging component from the Components menu where you want it to be on the page.
 components menu in site builder in salesforce
 Components Menu in Site Builder in Salesforce, image source: Trailhead
embedded messaging component settings in salesforce site builder
Embedded Messaging Component Settings in Salesforce Site Builder, image source: Trailhead
Click Publish.

11. Demo Your Service Agent

Now, you can test your Agent in your production environment. It might go like this:
customer chat with salesforce service agent
Customer chat with Salesforce Service Agent, image source: Trailhead
As a result of this interaction, there’s the case created by the Agent in your Salesforce org:
case created by salesforce service agent
Case Created by Salesforce Service Agent, image source: Trailhead

To Wrap Up

By following this guide, you can gain valuable insights on how to streamline your customer service operations with Agentforce.
Remember to test your configurations thoroughly to ensure everything runs smoothly.
For more information on Agentforce and its features, check out our Agentforce overview.
For any further assistance on configuring Service Agents in Salesforce, reach out to Twistellar. We have QuickStart packages available for you to kickstart Agentforce fully calibrated for your business use cases.
Twistellar's team has carried out a number of industry-oriented projects and we are always open to discuss yours!
Chief Executive Officer at Twistellar Europe
Our deep understanding of Salesforce platform ensures successful handling of projects in any domain
By submitting you agree to receive a newsletter from Twistellar. You can unsubscribe anytime.
Our Best Articles and Salesforce Overviews
Feeling like teaming up with us at Twistellar? We are excited too! Whether you'd like to customize your org, build a bespoke application or integrate a third-party tool, Twistellar is ready to help you.
Get in touch to discuss your Salesforce ideas!