Please find below the solution to your problem using Handler Class ->
//LeadTrigger ------------------ trigger LeadTrigger on Lead (before insert){ if(Trigger.isBefore){ if(Trigger.isInsert){ LeadTriggerHandler.main(Trigger.new); } } }
//LeadTriggerHandler ---------------------------- public class LeadTriggerHandler{ public static void main(List<Lead> leadList){ for(Lead lead : leadList){ if(lead.Rating == 'Hot' && lead.Phone == NULL){ lead.Phone.addError('Phone number is mandatory'); } } } }
If this solves your problem then please mark this as the best answer.
Please find below the solution to your problem using Handler Class ->
//LeadTrigger
------------------
trigger LeadTrigger on Lead (before insert){
if(Trigger.isBefore){
if(Trigger.isInsert){
LeadTriggerHandler.main(Trigger.new);
}
}
}
//LeadTriggerHandler
----------------------------
public class LeadTriggerHandler{
public static void main(List<Lead> leadList){
for(Lead lead : leadList){
if(lead.Rating == 'Hot' && lead.Phone == NULL){
lead.Phone.addError('Phone number is mandatory');
}
}
}
}
If this solves your problem then please mark this as the best answer.
Thanks and Regards
Harshit Kumar
By mistake I wrote someone elses name in the above reply..
You should use validation rule Instead of trigger , Please follow below validation rule:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
try with below rule.
If this helps, Please mark it as best answer.
Thanks!!
Refer the following for idea-
https://www.youtube.com/watch?v=4kQ_CAFALos
AND( ISPICKVAL (Rating,"Hot"),
If this helps, Please mark it as best answer.
Thanks Regards,
Syed Jabeena
Hi, Chandraprasanth G
Please follow below validation rule:-
AND( ISPICKVAL(Rating, "Hot") , ISBLANK(Phone))