How to Handle Email Input in Salesforce Agentforce Employee Agent?
Sep 10, 2026
Show More Show Less
View Video Transcript
0:08
Hello everyone.
0:09
In this video, we are going to see
0:11
how to handle
0:13
email input in Salesforce Agent Force
0:16
employee agent.
0:20
If you are creating Agent Force uh
0:23
actions,
0:24
in those uh actions, if you're going to
0:27
get email input,
0:30
then you can make use of this video for
0:32
your reference
0:35
for handling the email inputs in your
0:37
implementations.
0:43
For handling the email inputs,
0:46
I'm going to have
0:48
two layers.
0:49
The first layer is subagent
0:51
instructions.
0:53
In the subagent instruction,
0:56
I will give uh
0:57
few instructions or set of instructions
1:00
in the subagent so that the email
1:02
entered by the user will be
1:05
sanity tested
1:07
with the help of subagent instruction.
1:11
We cannot solely res-
1:13
um
1:15
depend on
1:17
the subagent instructions alone.
1:20
In order to further more
1:22
validate whether the email input is uh
1:26
valid, we have to do that in the agent
1:29
action. For example, here I'm going to
1:31
make use of uh
1:34
flow agent action. So, in the flow,
1:37
before I do the process, for example, if
1:40
I wanted to get all the contact uh
1:43
records matching the email address,
1:46
then the first step what I have to do is
1:48
I have to validate whether the email
1:51
that was uh sent by the Agent Force
1:53
agent is valid.
1:55
Once it is uh validated, then I have to
1:58
go and
2:00
fetch the contact records related to
2:02
that email address. So, in order to
2:05
handle the email input,
2:08
the first layer of
2:10
sanity testing will be done with the
2:12
help of sub-agent instruction. And the
2:14
second layer will be
2:17
flow or Apex based on your agent action.
2:25
Let's
2:26
uh look at a example here. I'm going to
2:30
invoke my employee agent force
2:33
agent.
2:34
I'm going to make use of the prompt my
2:37
open cases or update a case.
2:42
It is asking me to enter the email
2:44
address
2:45
so that it can fetch related cases.
2:48
I'm going to say [email protected].
2:52
I forgot to enter
2:54
at symbol here.
2:59
The agent force agent is saying that the
3:01
email address you provided
3:03
is missing at symbol.
3:05
I'm doing this sanity testing
3:09
with the help of my
3:11
sub-agent instruction.
3:14
So, here I'm saying the email address
3:17
um
3:19
So, here I'm saying it should contain
3:22
at symbol, it should contain dot, like
3:24
that. I'm validating or sanity testing
3:27
the email address that is inputted by
3:30
the user.
3:33
Now, I'm going to say to the agent force
3:36
agent
3:38
that this is my email ID.
3:46
Now,
3:49
I'm able to get
3:51
related cases
3:56
with the help of the email address that
3:58
was provided.
4:00
This is the flow which is uh
4:04
invoking uh
4:07
get records
4:09
uh flow elements to get all the case
4:12
records that are matching the email
4:14
address that are provided. Before I make
4:17
use of this get records,
4:19
the first step
4:20
I am checking whether the email that is
4:23
provided is valid or not. In order to
4:26
verify that, I am making use of
4:29
a formula field. In the formula field,
4:33
I'm getting the
4:35
email address from the user that was
4:39
given as an input.
4:41
And using rejects method, I'm checking
4:43
whether it is a valid email or not. Once
4:46
it is uh
4:48
validated, once it is a valid email
4:50
address,
4:51
then I am fetching the
4:53
cases that are matching the email.
4:55
Next, I'm sending a message saying that
4:57
it is a valid email.
4:59
And a success, which is a boolean
5:01
variable, I'm setting it to true. Let's
5:03
say
5:04
somehow the sub agent was unable to do
5:07
sanity testing or with the help of
5:09
instructions, whatever I have mentioned,
5:11
it was not able to
5:13
um
5:14
validate a right email address, then in
5:18
the error assignment, I'm saying message
5:20
invalid email, success has false because
5:24
in the second layer of testing
5:27
using the formula field, using the
5:29
rejects, I was able to find out that the
5:31
email that was uh sent from the agent
5:35
was not is not valid.
5:38
So, all So, in order to handle email
5:41
input in your Salesforce agent force
5:43
agent actions,
5:45
make sure you are following this dual
5:47
layer of
5:49
validation
5:50
for
5:51
for a strong foundation of handling
5:53
email inputs.
6:03
Please check the video description. In
6:05
the video description, I have shared my
6:06
blog post. From the blog post, you will
6:08
be able to get
6:10
the sample Agent Force agent script that
6:13
was used in this video for your
6:15
reference.
6:23
I hope it was helpful.
6:36
Thank you for watching.
#Internet Software
#Science
