Pass Messaging Session from Agentforce to Flow Action
Jan 18, 2025
Standard MessagingSession context variable can be used to pass Messaging Session from Agentforce to Flow Action. Blog Post: https://www.infallibletechie.com/2025/01/pass-messaging-session-from-agentforce-to-flow-action.html
View Video Transcript
0:05
hello everyone in this video we are
0:07
going to see how to pass Salesforce
0:10
messaging session record from agent
0:13
force to the flow
0:16
action in Salesforce agent force we have
0:19
context variable if you wanted to know
0:22
know more about it you can check this
0:24
context variables us AG in Salesforce
0:26
agent
0:27
force the standard messaging session
0:30
contact variable can be used if you
0:32
wanted to pass the messaging session
0:34
record to the agent force flow
0:37
action let's see
0:40
the agent so this is uh uh a sample
0:45
Salesforce agent force agent I'm using
0:49
uh two topic actions for this topic
0:53
called Product
0:55
interest in this uh product interest
0:58
topic first I'm getting the basic
1:01
information from the user I'm creating
1:03
the
1:04
lead after the creation of the lead I'm
1:07
creating a follow-up
1:10
task I'm going to make use of these two
1:14
agent action so that I can create a lead
1:17
and as well as the task
1:19
record first in order to create a
1:22
lead I am
1:24
passing description of the lead email of
1:27
the lead first name of the lead last
1:29
name of the lead and also I am passing
1:32
messaging session input variable on the
1:35
flow
1:37
here I have mentioned in the instruction
1:40
to the agent force agent stating that
1:43
always use messaging session found in
1:45
the context variables never use user
1:48
provided information for this input so
1:50
this is the instruction I have given so
1:52
it will make use of standard messaging
1:55
session context variable in order to
1:57
invoke this flow
2:03
in this
2:06
flow this is
2:08
the messaging session uh input
2:12
variable data type is record object is
2:15
messaging
2:16
session and this is a sample
2:19
description first I'm creating a lead
2:21
record with company as agent force
2:24
description from the uh from the agent
2:26
force action description similarly I'm
2:28
making use of email first name and last
2:31
name once the lead is created if there
2:34
is a failure I'm sending unable to log
2:37
your information as the error
2:40
message if it is successfully created it
2:44
will check whe whether the messaging
2:45
session record is not null and also it
2:48
is I'm making sure it starts with z MW
2:51
I'm doing these two conditions because
2:54
when we do the development of Agents
2:56
agent force agent we always test it from
2:59
the agent build Builder so whenever we
3:00
test it from agent Builder we won't have
3:02
messaging session record sometimes it
3:04
sends random uh text value in order to
3:08
avoid some runtime exception I'm making
3:10
sure the messaging session is not null
3:13
and also I'm making sure it starts with
3:15
z MW so that it is a messaging session
3:18
record
3:19
ID next I'm updating the messaging
3:23
session the field I'm updating is lead
3:26
ID with the lead record that was created
3:28
as part of this
3:30
create lead next I'm sending a message
3:33
stating that your information is locked
3:34
successfully and uh I I have some
3:36
additional text in in in that
3:41
assignment okay next for followup task I
3:46
am having two input variables messaging
3:48
session similar to the create lead agent
3:51
action and here I'm going to use due
3:55
date on the task as this available date
3:59
so let's look at this
4:04
flow so similarly I have a messaging
4:07
session input variable on the
4:09
flow first I'm checking whether the
4:12
messaging session is not null and also
4:13
I'm making sure it is starting with z MW
4:16
the ID of the messaging session
4:20
record I'm fetching the messaging uh
4:28
session and uh I'm assigning lead ID
4:32
this is an a variable equal to the lead
4:35
ID from the messaging session
4:37
record next I'm creating a task
4:44
record if if it is successful I'm
4:47
sending a successful message if there is
4:48
any failure I'm sending a failure
4:51
message so let's see this in action
5:03
okay my sales force agent force agent
5:05
has joined it is asking how can I help
5:08
you so I'm going to say I am
5:11
interested in running
5:21
shoes Okay in order to proceed further
5:23
it is asking my first name last name and
5:25
email address before that let's make
5:27
sure it created the messaging session
5:29
record yes this is the messaging session
5:32
record which got
5:33
created so this is the latest
5:37
one I'm going to make use of this
5:41
information as my first name last name
5:43
and
5:44
email this is a sample dummy
5:55
data okay it says that it successfully
5:58
logged my information let's verify that
6:01
okay it invoked the flow it created a
6:04
lead and then it linked the lead to the
6:06
messaging session record so I was able
6:09
to pass the messaging session
6:11
record from agent force agent to the
6:15
flow action so this is the lead which
6:17
got created as of now it doesn't have
6:19
any activity now it should ask for my
6:22
availability it is asking my
6:23
availability I'm going to say I'm
6:25
available on 30th Jun
6:36
okay it says that your followup task has
6:38
been locked successfully let's verify
6:45
that okay this is the
6:48
one Let me refresh the screen so that I
6:51
can see that okay it created the
6:54
follow-up task and uh this is the
6:58
followup task which is tied to this lead
7:01
and this lead is tied to this messaging
7:03
session so you can also make use of
7:06
context variables to pass uh um me so
7:11
you can also make use of context
7:13
variable to pass messaging session
7:15
record from the agent force agent
7:19
to flow
7:25
action please check the video
7:27
description the video description I have
7:30
shared my blog post from the blog post
7:32
you should be able to get
7:34
screenshots and the instructions that
7:36
were
7:37
used uh so that it will be used as a
7:40
reference in your
7:48
development I hope it was
7:54
helpful thank you for
7:58
watching e
#Business Education
#Education
#Internet Software
#Software
