Show More Show Less
View Video Transcript
0:07
Hello everyone. In this video, we are
0:10
going to see how to manage restricted
0:13
pick lists in Salesforce agent force. If
0:17
you are using agent force action where
0:20
you have to invoke an agent action and
0:24
if it is looking for uh picklist input
0:28
value. So for example uh case status
0:32
case priority opportunity stage uh
0:36
account industry account type. So these
0:38
are all some standard pick list and also
0:41
if you have some custom pick lists in
0:43
your object and then if you wanted to
0:45
manage it while invoking agent action
0:49
with some agent uh inputs then you can
0:52
make use of this video as a reference.
0:54
Please note that this particular uh
0:57
approach what we are going to see in
0:59
this video is for a pick list with less
1:03
number of picklist values. If you are
1:06
having huge number of picklist values in
1:09
your pick list and then if the pick list
1:11
pick list is going to be frequently
1:14
updated or if you have dependent pick
1:16
list then this approach might not be
1:19
that helpful for you.
1:21
Okay, let's see a quick demo and then we
1:25
will walk through the technical
1:27
implementation to achieve this use case.
1:30
So I'm going to invoke my agent force
1:34
agent.
1:43
Looks like I don't have access to this
1:45
agent. So
1:48
let me give access to this agent.
2:03
I'm going to test the employee agent
2:04
force agent.
2:13
Okay, now I can see the agent uh force
2:17
icon. It invoked my agent force employee
2:20
agent. I'm going to say update a case.
2:26
It will ask email address. I'm going to
2:29
give
2:30
my email address.
2:34
So there are um
2:37
two cases that are assigned to my email
2:40
address. Priority is medium. Priority is
2:43
low. Here I wanted to bump this uh case
2:46
uh priority. So I'm going to say
2:50
update
2:52
case priority
2:56
as urgent.
3:00
add comments as
3:09
solution
3:11
needed as a okay
3:16
let's look at the case object so that
3:18
you will have an idea so if I go to the
3:22
case object
3:25
in the case priority which is uh pick
3:29
list field I have high low medium high
3:33
medium low but I don't have urgent as
3:36
the
3:38
status so here
3:42
urgent means definitely it is high by
3:44
the word we can easily understand also
3:48
based on the historical data I have seen
3:51
customers or the or my internal users
3:55
using urgent as uh high so It should
4:00
update the case priority currently it is
4:03
with low. It should update it with
4:06
high since it is
4:09
requesting as urgent. So let's look at
4:11
the case first.
4:14
So currently it is low. So I'm going to
4:20
send. So now it will update the case.
4:23
So the priority is now set to high which
4:26
is urgent as per the request. comment is
4:29
added as solution needed
4:32
as a
4:35
so now
4:41
okay so the priority is high solution is
4:44
needed as a
4:46
priority is updated just now from low to
4:50
high let's see how I was able to manage
4:54
this restricted pick list field value.
4:59
I have sub agent called case management.
5:02
Here fetch cases by email will make use
5:05
of a flow and then it will fetch the
5:08
cases by getting by using the email
5:12
address. Next update case is a flow
5:15
agent action which updates a case. It
5:19
adds a comment and also it updates the
5:22
case with the priority. So here case
5:26
comment is a string. Case ID comes from
5:30
the selected case from the fetch cases
5:34
by email agent action. And in the case
5:37
priority we have description. So here
5:39
I'm instructing the lm with this
5:42
instruction.
5:43
This is a case priority field. Allowed
5:45
values. It is query case sensitive low,
5:48
medium and high. It cannot have any
5:50
other value. And also I'm instructing
5:53
the LM to map to map them users wording
5:56
to the closest value. For example, if
5:58
they say low, low priority, minor, not
6:00
urgent, then it should update the case
6:03
status as low. Similarly, for medium and
6:06
high also I have instructed what values
6:10
the users are entering and then it it
6:13
will try to find the closest value and
6:15
then it will set the priority.
6:18
One more important thing is
6:20
this is at the agent level. So it is
6:23
layer one of guardrail in the next the
6:27
next guardrail where I am I have applied
6:30
here is on the flow which updates the
6:33
case. So the case is getting updated
6:35
here. Prior to that
6:41
what I'm doing is I'm fetching all the
6:43
picklist value from the object picklist
6:48
value info. This picklist value info
6:50
object contains case priorities picklist
6:53
values.
6:55
So from the with the help of get records
6:58
flow element from the picklist value
7:00
info object I'm getting all the picklist
7:04
values for case objects priority field.
7:08
So entical particle ID will have case
7:10
dotpriority for all the case object
7:14
priority picklist values. Next using
7:17
transform I am getting all the values. I
7:22
don't want the label, I want the value.
7:24
Because when we try to create a record,
7:27
we have to pass the API uh value. So I'm
7:29
just extracting all the API value for
7:32
that particular pick list values. In
7:34
this case, it will have high, medium,
7:37
and low. Next I'm checking whether the
7:40
case priority whatever
7:44
um the llm whatever the agent force
7:48
agent action passed to the flow is not
7:50
not blank I'm just checking whether it
7:53
is not blank once it is not blank I'm
7:56
checking whether the transformed
7:59
pick list values that is low medium and
8:02
high contains the value that that is
8:04
passed if it is passed then it is
8:08
valid pick list value that was passed by
8:11
the agent action. Else if they if they
8:15
are by some mistake if the LLM
8:19
instructions were not followed and if
8:21
the agent action was invoked without
8:24
proper value then it will be invalid. It
8:29
is iterating all the pick list values
8:31
here from the transform and then I'm
8:35
adding all those values to the case
8:37
priority values which is a list text
8:40
list of text flow variable
8:43
from from the uh loop I'm getting I'm
8:47
assigning that value. Next I am sending
8:50
a message saying that success is false.
8:52
Message is case priority value is
8:54
incorrect.
8:56
Please
8:58
provide
9:00
one of the values from the case priority
9:03
values which was uh which is uh nothing
9:06
but the values from the
9:11
pick list value info from the transform
9:14
flow element.
9:16
So now if they pass an incorrect uh pick
9:20
list value then here in the agent action
9:23
which is uh at the core level of flow
9:25
itself you are preventing uh the uh
9:29
error or exception
9:31
this so there are two um guard rails are
9:36
happening here one at the agent action
9:38
level at the input level we are
9:41
instructing the LLM to make sure it is
9:44
passing passing the right value and the
9:47
next guardrail is at the core flow level
9:50
execution itself. So I am adding two
9:53
guardrails so that
9:56
I don't want to pass any incorrect value
9:58
and I don't want to um face restricted
10:02
picklist DML exception when the record
10:05
is getting created or when the record is
10:06
getting updated.
10:14
Please check the video description. In
10:16
the video description, I have shared my
10:18
blog post. From the blog post, you
10:20
should be able to get the sample agent
10:22
script code for your reference.
10:33
I hope it was helpful.
10:40
Thank you for watching.
Internet Software
Science
