Pass Record Id to Salesforce Employee Agentforce Agent
Aug 15, 2026
Blog Post:
https://www.infallibletechie.com/2025/05/pass-record-id-to-salesforce-employee-agentforce-agent.html
Show More Show Less View Video Transcript
0:08
Hello everyone. In this video, we are
0:10
going to see how to pass the current uh
0:15
viewing record ID to the employee agent
0:18
force agent. Let's say I'm on a case
0:21
record and then I would like to
0:23
summarize that case. I have to open the
0:25
case. I have to open the agent employee
0:28
agent force agent in my lightning
0:30
experience application and then I can
0:33
prompt asking can you summarize this
0:35
case record for me. Once I do it I
0:38
wanted to pass the currently viewing
0:40
case ID to the employee agent force
0:42
agent so that the respective agent
0:44
action will be invoked to summarize and
0:47
provide the information. In order to do
0:50
that, we can make use of current record
0:53
ID context variable.
0:56
First, let's see a demo and then we will
0:59
see what configuration was done to
1:02
achieve this particular use case.
1:05
I'm currently on a on an account record.
1:08
I'm going to open my employee agent
1:10
force agent
1:12
and then I'm going to ask the employee
1:16
agent force agent to summarize
1:20
this account record for me.
1:26
I'm using agent script so the new
1:29
builder and then I'm able to get the
1:32
account name type and all additional
1:34
information so that it was able to
1:36
summarize and provide related contact
1:38
and related opportunity record also it
1:41
was able to find no tasks future events
1:44
or emails that are currently listed
1:45
under under this particular account
1:47
record. So I was able to quickly get a
1:50
summary of this particular account
1:52
record using my employee agent force
1:55
agent. I was able to pass the record ID
1:58
because I was passing current record ID
2:01
context variable. I have added the
2:04
sample agent force agent script for your
2:08
reference. So here
2:11
the current record ID is an is a
2:14
variable
2:16
and uh
2:20
I'm having general FAQ topic or not not
2:24
general FAQ I have a sub agent called
2:27
summarize the record.
2:31
So the sub agent is summarized, label is
2:34
summarized. Here I'm asking the agent
2:38
force agent to run this get record
2:42
details and summarize the details.
2:46
When this particular action runs, I'm
2:49
using the variable current record ID.
2:53
Let's see in the agent force builder so
2:55
that we will have a better
2:57
understanding. So summarize is a custom
3:01
uh sub agent. It is not the it is not a
3:04
standard sub aent. Get record details is
3:07
a standard Salesforce agent action. So
3:10
I'm not developing or customizing using
3:14
flow or apex here. I'm making use of
3:16
standard get record details agent force
3:18
agent action. When this particular uh
3:25
uh sub agent is uh picked by the
3:27
reasoning engine, it will run the get
3:30
record details uh agent action and then
3:32
it will summarize the details in the
3:36
agent action which is uh get record
3:40
details standard action for the input.
3:43
I'm directly passing the current record
3:45
ID which is the variable if you see it
3:47
in script.
3:54
So whenever this particular action get
3:56
record details get executed I am passing
4:00
the record ID as at variables dot
4:04
current record id which is a context
4:06
variable. record ID is the input for uh
4:10
the standard uh get record details
4:13
standard action. So I'm passing the
4:15
current record ID using the current
4:17
record ID
4:19
context variable.
4:22
If you're still on the old Salesforce
4:25
agent force builder or the legacy agent
4:27
force builder then in order to pass the
4:30
current record ID you have to add a add
4:33
an instruction. So the instructions
4:36
should be pass the context variable
4:38
current record id. Uh so the deal check
4:42
action is a custom uh apex action I have
4:46
uh used in this demo.
4:49
So when I am on an opportunity record
4:51
and then if I say deal check it will
4:54
invoke that sub agent and then the
4:56
record ID will be passed to the apex
4:58
class and the apex class will be able to
5:01
uh fetch that information.
5:04
So this is a sample Apex action which is
5:08
making use of the old legacy builder for
5:11
agent force development. And then I was
5:14
able to pass
5:16
in order to pass the current record ID I
5:19
in the instruction I clearly mentioned
5:21
that pass the context variable current
5:24
record ID to the deal check action.
5:29
So in the input we have to add the
5:32
instruction so that the current record
5:34
ID is passed. You can also bind the
5:37
variable that is also another way if you
5:40
are using the old legacy agent force
5:42
builder.
5:47
So make use of current record ID context
5:49
variable to pass the currently viewing
5:52
record ID to your agent uh employee
5:55
agent force agent.
6:04
Please check the video description. In
6:06
the video description, I have shared my
6:08
blog post. From the blog post, you
6:10
should be able to get the sample agent
6:12
script and also if you are using the old
6:15
agent force legacy builder to build your
6:17
agent force agents. Then you then you
6:19
can make use of the sample apex class
6:22
and uh the instruction using which I was
6:25
able to pass the currently viewing
6:27
record ID. Uh if in in the in the old or
6:31
the legacy agent force builder
6:42
I hope it was helpful.
6:52
Thank you for watching.
#Science
