Trigger Assignment Rule when a Lead is created using Apex
999 views
Nov 6, 2024
Show More Show Less
View Video Transcript
0:04
foreign
0:06
in this video we are going to see
0:10
how to fire
0:12
lead assignment rule
0:14
in a lead is getting created via Apex
0:19
whenever we insert a lead
0:22
using Apex the assignment rule won't be
0:25
fired by default
0:27
we have DML options available in Apex
0:31
through which we can trigger the
0:34
assignment rule
0:36
so in this video we are going to see how
0:39
to do that
0:40
So currently I don't have any open leads
0:45
I'm going to insert a lead with first
0:47
name as test one last name and as test2
0:50
company as testing and email as
0:54
tester dummy test.com and I am
0:59
initiating
1:00
database.dml options
1:03
with this variable
1:05
I have initialized and then I'm using
1:09
assignment ruleheader dot use default
1:12
rule equal to true so this will make
1:15
sure the default assignment rule will
1:17
get triggered
1:19
when we set
1:21
the options
1:23
for this lead so for this lead record
1:26
which I have initialized I'm set I'm
1:29
using set options method and then I am
1:31
setting this particular
1:33
DML options in the DML options I have
1:36
set assignment ruleheader dot use
1:39
default rule equal to true
1:41
and since this uh lead gets this option
1:45
and when the lead is getting inserted at
1:47
line number 10 it will make sure to
1:49
trigger this particular lead assignment
1:51
rule
2:03
he even didn't know
2:07
see this is the assignment rule
2:11
and we can easily find out whether the
2:14
assignment rule got triggered
2:26
okay so assignment rule so this is the
2:28
workflow for um in debug log for
2:32
assignment rule we see workflow and this
2:34
is the assignment Rule and this is the
2:36
lead this is the first condition uh
2:39
whether country equals any of this yet
2:42
no so it is setting it to false it is uh
2:46
evaluating the next criteria country not
2:50
equal to yes because I didn't set the
2:52
country so this will be true and the
2:55
lead is assigned to lead queue
2:59
and it was assigned via assignment rule
3:09
so if you go to Charter
3:11
the lead got assigned using assignment
3:14
rule
3:15
and this is the lead record which we
3:17
created via Apex
3:23
so use DML options and in the DML
3:27
options use assignment ruleheader.us
3:29
default or equal to true to fire or
3:32
trigger lead assignment rule when a lead
3:34
is created using Apex
3:45
I hope it was helpful
3:57
thank you for watching
#Internet Software
#Software