Salesforce Agentforce to Agent transfer Business Hours Check
9K views
Apr 10, 2025
Show More Show Less
View Video Transcript
0:06
hello everyone in this video we are
0:09
going to see how to transfer from
0:12
Salesforce agent force agents to human
0:16
agents based on business hours if you
0:19
have a requirement based on
0:22
the agents availability then you can
0:25
make use of this video as a reference
0:27
and then you can do the business logic
0:30
of checking whether we can route it to
0:34
human agents or not using this video as
0:37
your
0:39
reference the first step is we should
0:42
create an omni channel flow in the omni
0:45
channel flow we have to define route
0:49
work uh action in the route work we have
0:53
to decide how to transfer it whether it
0:56
should be transferred to a queue whether
0:58
it should transfer based on the uh
1:00
skills based uh routing rules whatever
1:03
you have set up or uh skills matching
1:05
whatever logic you wanted to build you
1:07
you have to build it in the omni channel
1:10
flow for routing it to the agents but
1:12
here in this video we are going to
1:14
see this previous step before routing it
1:18
i wanted to route it from the agent
1:21
force agent to human agents only when it
1:24
is within the business hours if it is
1:27
outside the business hours I don't want
1:29
the agent force agent to transfer it to
1:32
human agents instead I wanted to inform
1:36
the visitors whoever initiated the
1:39
messaging session saying that hey it is
1:42
outside our business hours you have to
1:44
reach out within our business hours so I
1:46
won't be able to transfer it you to
1:48
human agents first let's see a
1:55
demo I'm going
1:58
to initiate Salesforce messaging for
2:01
inapp and web session
2:05
I'm going to
2:06
say can
2:09
you
2:12
escalate to an agent to assist
2:18
me it will do an apex action in the apex
2:22
action I'm checking whether it is within
2:25
the business service if it is not within
2:27
the business service I am sending this
2:29
message
2:31
let's see the configuration behind
2:38
it okay one second okay so
2:41
here messaging for inapp and web router
2:44
Q is the omni channel flow which I have
2:47
developed this will route it to the
2:49
agent but before executing this in the
2:55
topic I'm making use of custom
2:58
escalation topic you can add the
3:00
standard escalation topic from
3:02
Salesforce and you can uh create a new
3:06
version of the standard escalation topic
3:09
and then in the instructions you we have
3:11
to tweak it so here I'm saying if a user
3:14
explicitly asks to transfer to a live
3:17
agent escalate the conversation only if
3:21
is business hours within business hours
3:24
from the business hours check action is
3:26
true if it is false share the me the
3:30
variable value from the action
3:34
here this is the apex action this is the
3:38
apex class class which uh will be
3:41
getting invoked here I am passing the
3:44
record
3:45
ids and uh the output is two things is
3:49
within business which is a boolean
3:51
variable and strage is another variable
3:55
which which is of string data type which
3:57
will be
3:59
returned so
4:02
here this is the apex class and method
4:05
I'm getting the record ids so we have to
4:08
since it is uh uh going to pass only one
4:11
record ids uh sorry one record id I'm
4:14
just adding a systemdebug
4:17
statement here I'm getting the business
4:21
hours output variable declaration so
4:24
this is the variable declaration so
4:27
sorry this is the wrapper class which
4:29
will contain str message and whether it
4:32
is within business service so I'm
4:34
fetching the business service
4:37
object and then uh I'm doing all the
4:41
checks whether it is within the business
4:42
hours or not if it is within the
4:44
business hours it will be able to set
4:48
the is within business hours as
4:51
uh true else it will return uh is with
4:54
within business hours as false if it is
4:56
false then it will send a message saying
4:58
that I cannot transfer now it is outside
5:01
of business hours for emergency call our
5:04
2471800 number so this is the message it
5:06
will send if it is outside the business
5:09
service let's uh use a different uh
5:14
business
5:16
service so that it is within the
5:19
business hours and then it should be
5:20
able to transfer
5:22
it so I'm going to end it i'm going to
5:26
refresh my
5:29
screen so now I'm going to ask the same
5:31
thing
5:34
can you
5:36
transfer to an
5:41
agent
5:43
to assist me so this is the message I'm
5:46
sending now it is within the business
5:49
service so it will route it and then it
5:53
is transferring it
5:55
now if I'm available as an
6:00
agent I should be able to get the
6:02
messaging session
6:08
record so this is the check I'm doing it
6:12
whenever the visitors wants to escalate
6:16
it to an
6:17
agent please check the video description
6:20
in the video description I have shared
6:22
my blog post from the blog post you
6:24
should be able
6:25
to know more information like how to
6:28
transfer the messaging sessions from
6:31
Salesforce agent force agents to real
6:34
agents the human agents sample apex
6:37
class which I'm making use of for
6:39
checking whether it is within the
6:40
business hour or with whether it is
6:42
outside the business
6:45
hours and I have given the instructions
6:48
I have
6:52
system so you can make use of this as a
6:55
reference and then you should be able to
6:56
achieve based on your use
7:05
case i hope it was
7:12
helpful thank you for watching
#Business & Industrial
#Internet Software
#Jobs & Education