Dynamic Welcome Message in Salesforce Agentforce Agent Script
Jun 25, 2026
Show More Show Less
View Video Transcript
0:07
Hello everyone.
0:08
In this video, we are going to see
0:10
how to dynamically greet uh
0:13
customers
0:16
if they are using Agent Force uh service
0:18
agent
0:19
and they have done the development using
0:21
Agent Script.
0:23
The first step for that
0:26
use case what I have done is uh
0:28
I created a welcome message custom field
0:31
in the messaging session object.
0:34
Whenever a session is uh
0:36
created, it is it is uh it will be
0:38
getting routed to Agent Force service
0:40
agent.
0:41
First, it will go to the
0:46
agent router and the agent router will
0:49
display the welcome message. I wanted to
0:52
dynamically display that welcome message
0:54
for each and every messaging session
0:55
record. So, I created the welcome
0:57
message
0:58
directly on the messaging session
1:01
object. You can also try that in the
1:03
messaging user object
1:05
uh if you wanted to
1:08
uh make use of the custom field on the
1:10
messaging user object instead of
1:13
messaging session record.
1:14
Um
1:16
I have seen some use cases where uh
1:19
the dynamic welcome messages should come
1:21
based on the messaging user level. So,
1:24
if you wanted
1:25
you can make use of messaging
1:27
user object or entity also.
1:30
So, this particular field is created.
1:34
Next up,
1:36
the messaging session record is routed
1:39
using Omni-Channel flow.
1:43
Here, I'm updating the messaging session
1:46
object directly.
1:48
I am making use of the record ID
1:50
and then I'm finding the messaging
1:52
session record and then I'm updating the
1:54
welcome message custom field
1:57
with some hard coded value. We are glad
1:59
that you are here for our support. So
2:01
this is the
2:02
um value I'm updating on the
2:06
welcome message.
2:07
I'm updating the messaging session
2:09
record before the route work flow
2:11
element. So make sure you are doing
2:13
that. If it is uh
2:15
happening after the route work, then you
2:17
might not able to get the value.
2:21
So make sure you are doing it before the
2:24
route work flow element.
2:26
After that, I'm updating I'm routing the
2:29
messaging session
2:30
to the agent for service agent. The name
2:32
of the agent is service agent.
2:37
In my messaging channel, I'm making use
2:40
of that messaging uh
2:42
sorry, the Omni-Channel flow
2:44
as the routing type.
2:47
This is my
2:49
embedded service deployment, which is
2:51
tied to that messaging channel.
2:55
There are
2:56
two ways to give field level access to
2:59
the Einstein uh
3:01
uh user.
3:03
The
3:05
Einstein user will make use of Einstein
3:07
agent user profile. So you can give
3:10
the welcome message field level access
3:13
at the profile level.
3:14
Or you can create a permission set, and
3:17
then you can assign it to that uh
3:18
Einstein agent user.
3:20
And then you can grant field level
3:22
security.
3:27
Next, let's uh test it. So I'm going to
3:30
click Ask Me Anything.
3:34
Let me start a new conversation.
3:39
The service agent joined.
3:43
And it is saying, "Hi, I'm an service uh
3:46
AI service assistant. We are glad that
3:47
you are here for our uh support." So
3:49
this This the dynamic message that is
3:51
coming from the Omni-Channel flow.
3:55
So, in order to achieve it,
3:58
in the welcome message,
4:01
I'm making use of variables.welcome
4:04
message. This uh
4:07
welcome message
4:09
is a linked string.
4:12
For the source, I'm using messaging
4:14
session object.the custom field.
4:20
If you look at the start agent,
4:23
the first step here is welcome the user,
4:26
and then it should determine the
4:27
appropriate sub-agent based on the user
4:30
input. So, it will wait for the user
4:32
input
4:34
after the
4:35
welcome.
4:36
So, the sub-agent agent router is
4:39
getting invoked.
4:40
It is welcoming the user with the help
4:42
of a welcome message.
4:44
Here, I have dynamically made use of the
4:46
variable
4:47
welcome message, and this particular uh
4:50
welcome message is a linked uh variable
4:53
type in the agent script.
4:55
The source is messaging session.welcome
4:57
message.
4:59
So, with the help of linked uh variable,
5:02
I was able to dynamically greet the
5:05
customer.
5:08
So, for your use cases,
5:11
try to make use of this Omni-Channel
5:13
flow.
5:14
Here, I have hard-coded the
5:17
greeting message, but you can
5:19
dynamically pull it from
5:22
a custom metadata type,
5:24
or you can build the dynamic value here
5:27
within the flow
5:28
uh based on the messaging user, based on
5:31
the messaging session record, or if you
5:34
have any uh configuration, then you can
5:37
dynamically invoke that configuration
5:38
like custom metadata type, and then you
5:40
should be able to
5:41
build the
5:43
welcome message here.
5:46
If I go to the messaging session record,
5:51
I should be able to see the welcome
5:52
message.
5:53
The linked variable is getting the value
5:56
from this custom field.
6:04
I hope it was helpful.
6:10
Please check the video description. In
6:12
the video description, I have shared my
6:13
blog post. From the blog post, you
6:16
should be able to get the sample agent
6:18
script which was referenced in this
6:21
video.
6:23
I will also try to add some screenshots
6:26
of the Omni-Channel flow
6:31
in the blog post.
6:35
Thank you for watching.
#Internet Software
#Science
