Use Salesforce Agentforce Context Variables to greet Customers by Name
Sep 29, 2025
Show More Show Less
View Video Transcript
0:04
Hello everyone. In this video, we are
0:07
going to see how to greet customers
0:11
using their name when we are making use
0:14
of Salesforce
0:16
agent force uh service agent
0:20
in your enhanced chat messaging channel.
0:25
The first step is I have created a field
0:29
called visitor name
0:32
in the messaging session object or
0:34
entity. The formula for that is
0:38
messaging end user dot name.
0:42
So this is the field and this is the API
0:45
name of the
0:47
custom field.
0:50
Okay. Next, in the agent force builder
0:54
in the context variable, I have included
0:58
the visitor name
1:02
formula field. In order to do this,
1:05
deactivate the agent force agent.
1:08
Click edit include fields and then you
1:11
have to add visitor name formula field
1:14
in the included fields.
1:18
Once this is done
1:22
in the welcome message
1:24
you can use context dot
1:30
the API name of the field without double
1:32
underscore C
1:35
because
1:37
here
1:40
instead of using double underscore C it
1:42
will just make use of visitor name. So
1:46
you have to use
1:49
open FL braces exclamatory mark dollar
1:52
symbol context dot visitor name because
1:57
I'm using the API name without we have
2:00
to use the field name instead of the API
2:03
name in the field name it will contain
2:06
without double C.
2:12
Okay, I'm using uh experience cloud site
2:17
where uh my enhanced chat sessions can
2:21
be initiated and whenever the experience
2:25
cloud site users uh log in I am making
2:29
use of user verification using
2:31
credential so that it will make use of
2:34
the existing uh um messaging user record
2:38
and also if it is the if it is the first
2:40
session it will create the messaging
2:42
user with the first name and last name
2:45
from the contact of the experience cloud
2:49
site user.
2:52
Okay, let me log into experience cloud
2:55
site.
2:59
So the name is test contact.
3:03
So we can see that test contact. So here
3:07
I'm going to ask hi
3:12
I need help.
3:18
So now the Salesforce uh service agent
3:22
is connected and then it is greeting me
3:25
with the name
3:30
as per this welcome message
3:34
setup.
3:39
So make use of context variable so that
3:43
we can greet customers
3:47
using their name name. If you want to
3:50
fully customize the welcome message then
3:53
you can directly make use of
3:56
context dot the context variable. So
4:00
here create a text field and then uh
4:06
using dynamic u merging you can have uh
4:10
formula like this or you can make use of
4:13
hidden pre-hat field uh or in the omni
4:16
channel flow you can dynamically
4:19
set this welcome message and then you
4:21
can refer it in the
4:24
system messages
4:30
Please check the video description. In
4:32
the video description, I have shared my
4:34
blog post. From the blog post, you
4:36
should be able to get the sample welcome
4:38
message
4:40
and also the syntax that was used.
4:51
I hope it was helpful.
5:00
Thank you for watching.
#Internet Software
