Lead capturing using Salesforce Agentforce
Jan 21, 2025
We can make use of custom Flow Action to create or capture Lead record when using Salesforce Agentforce Agent. Blog Post: https://www.infallibletechie.com/2025/01/lead-capturing-using-salesforce-agentforce.html
View Video Transcript
0:05
hello everyone in this video we are
0:07
going to see how to make use of
0:09
Salesforce agent force agent to capture
0:12
lead
0:13
record for this demo I have created this
0:16
agent force agent I have made use of
0:20
General FAQ this is standard agent force
0:24
action which will make use of knowledge
0:26
articles or
0:28
files uh based on on the Einstein data
0:31
Library setup and then it will assist
0:34
the customer in this U uh agent force
0:38
agent I have created a custom topic
0:40
called Product
0:42
interest whenever a website visitor
0:45
visits my site and then if they are
0:47
interested in buying a product it will
0:50
try to capture a lead record and then it
0:52
will create a followup event
0:56
record so I have set the classification
0:59
description
1:00
I have set the scope to create a lead
1:02
record and an event
1:04
record I have set the instructions to
1:07
First gather the basic information next
1:09
it will create a lead record once the
1:12
lead record is created it will ask uh
1:15
the customer's availability for the
1:17
follow-up event once the availability is
1:19
shared it will create an event record
1:22
once the lead and event are created it
1:24
will update the
1:26
customer I am making use of two two
1:30
agent force actions here one is to
1:32
create a lead and the other one is to
1:34
create an event
1:37
record so this is my create lead agent
1:40
force agent action I'm making use of a
1:43
flow for
1:44
this I'm getting the description of the
1:47
lead email first name last name and
1:52
messaging session for the messaging
1:54
session I am making use of context
1:56
variable in agent force agent we have
2:00
context variable so I'm making use of
2:02
the messaging session contact
2:08
variable and then I will get an output
2:10
from the flow and then I will display
2:13
it to the
2:17
user so this is an autol launched flow
2:20
I'm creating a lead record with the
2:22
company as agent force description the
2:25
description uh uh from the agent force
2:28
agent email
2:30
first name and last name from the user
2:32
so all this information agent force
2:34
agent will capture from the user and
2:35
then it will pass it to the flow and
2:38
then it will create the lead
2:40
record once the lead record is created
2:44
I'm checking whether the messaging
2:45
session variable is null or not if it is
2:48
not null and then if it is starting with
2:50
0
2:54
MW I am updating the messaging session
2:57
record with the lead that was created so
3:01
once the once the lead is created I'm
3:03
checking whether the messaging session
3:04
was
3:05
passed this messaging
3:08
session is an input
3:10
variable which is uh passed as the
3:14
messaging session context
3:16
variable if it is passed and then if it
3:19
is starting with z MW I'm updating the
3:21
messaging session
3:24
record with the lead ID once uh that is
3:28
done it will send a success message else
3:31
it will send a error
3:40
message
3:42
okay so once this flow is executed it
3:45
will create a lead record and then it
3:47
will update the messaging
3:48
session I am checking whether it is not
3:51
null and then I'm checking whether it
3:52
is0 MW because we sometimes test it from
3:56
the studio Builder itself in the agent
3:59
Builder
4:00
some uh whenever we test it from here
4:02
the messaging session will not be
4:04
present so I'm making sure it is not
4:06
sending some random messaging ID and
4:08
then the flow will run into unwanted
4:10
errors or exceptions so that's the
4:12
reason I'm making sure uh to handle the
4:16
um agent Builder uh testing scenario
4:20
okay so once the lead is created I'm
4:23
calling this create event agent action
4:25
here also I'm using uh uh a flow in the
4:30
flow I'm I'm having available date time
4:32
as an input
4:33
variable so again I'm using messaging
4:37
session uh which is my context variable
4:39
on the agent force agent so here I
4:42
checking whether the messaging session
4:44
is passed or not if it is
4:46
passed I'm getting the messaging session
4:49
uh
4:50
record from there I'm getting the lead
4:52
ID I'm I don't want to get all the
4:54
fields I just want the lead ID so I'm
4:57
getting only the lead ID from the uh get
5:00
records element next I'm using
5:02
assignment flow
5:04
element uh here lead ID is a variable
5:07
where I'm setting the lead ID from the
5:09
messaging session
5:14
record I'm setting the due date time as
5:17
the available date time formula so let's
5:19
look at the formula
5:21
here the available day time which is
5:24
passed to the
5:25
flow it should be just one plus
5:36
okay so this available daytime I'm
5:38
adding 5 hours to it my customers are in
5:42
EST uh Eastern Standard time zone so I'm
5:45
adding plus F to it uh so that um
5:48
whenever uh the user entered day time is
5:51
passed to the agent force agent it will
5:54
pass it to the flow whenever it goes to
5:56
the flow uh here we are creating uh uh
6:00
an event record here it will be passed
6:02
in GMT so I'm adding plus 5 to it so
6:05
that it will convert that into Eastern
6:07
Standard time
6:09
zone so that is a uh reason I'm using
6:13
this available daytime formula okay and
6:16
then duration I'm setting it to 30
6:17
minutes subject agent force followup
6:20
followed by the messaging session
6:23
ID next for the name ID uh which is
6:27
which will be either contact or lead so
6:28
here I'm using lead so I'm passing the
6:30
lead
6:31
ID okay now let's uh test
6:43
it so agent force agent is invoked it is
6:47
asking how can I help you I'm going to
6:49
say
6:52
interested in running
6:55
shs let's see let's see whether the
6:57
messaging session was created
7:00
okay so this is the latest one the
7:02
messaging session is created it is
7:05
asking me to enter first name last name
7:07
and email to create the lead I'm going
7:10
to say first
7:13
name okay I'm going to say first name is
7:16
John last name is cat and this is the
7:18
email all these are dummy data just for
7:20
testing purpose
7:30
let's see whether it created the lead
7:32
and then updated the messaging session
7:35
record okay so I can see the lead is
7:37
linked to it so the messaging session is
7:41
created it linked the lead also it
7:43
created the lead and then it it linked
7:45
the messaging session next I'm going to
7:48
pass the date and time so I'm going to
7:50
say 30th
7:52
Jan I will say 1
7:55
p.m. now it should create a followup
7:57
event let's see whether it is creating
8:04
successfully okay uh followup event is
8:06
also successful let me end the
8:10
session let me go offline in Omni
8:13
because it didn't escalate due to some
8:15
error or
8:16
exception so everything went smooth this
8:19
is the messaging session this is the
8:21
lead this is the followup
8:24
event 1: p.m. to 1:30
8:28
p.m. so so here we can see
8:34
that I entered 1 p.m. so 1 p.m. to 1:30
8:41
p.m. one important thing here is I'm
8:44
running the create event flow in system
8:47
mode because uh I was unable to give
8:50
edit events to the agent force agent so
8:53
I'm giving uh I'm setting the flow to
8:56
run as system same thing for lead
8:59
creation also I'm running the flow in
9:03
uh system context I was unable to update
9:07
the messaging session with the lead
9:10
ID because for the agent force agent I
9:15
was unable to give edit permission to
9:18
the messaging session record things
9:20
might change as of now you can set it to
9:22
run a system once all these issues are
9:25
fixed once we are able to give access to
9:28
the agent for agent user then uh we can
9:32
run the flow in normal mode instead of
9:35
running it in system
9:43
context I hope it was
9:50
helpful thank you for watching
#Internet Software
