Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public with sharing class LeadTriggerHandler
- {
- @testVisible
- static Boolean bypassTrigger = false;
- @testVisible
- static Set<Id> recentlyAssignedOwners = null;
- final List<Lead> newLeads;
- final Map<Id, Lead> oldmap;
- public LeadTriggerHandler(List<Lead> newLeads, Map<Id, Lead> oldmap)
- {for (Lead a : newLeads)
- if(a.Marketing_List_CEC__c == false)
- continue;
- {
- this.newLeads = newLeads;
- this.oldmap = oldmap;
- }
- }
- public void beforeInsert()
- {
- if(bypassTrigger) return;
- List<Lead> leadsToRoute = Select.Records.all(
- new List<Select.Filter>{
- LeadRouter.isHeavyCivilLead(),
- LeadRouter.trialSource().notx(),
- LeadRouter.createdByMarketoBeforeInsert(),
- LeadRouter.hasQuantmSource().notx()
- }
- ).filter(newLeads);
- LeadRouter.routeToDealer(leadsToRoute);
- if (Test.isRunningTest()) {
- recentlyAssignedOwners = pluck.ids(Lead.OwnerId, leadsToRoute);
- }
- }
- public void beforeUpdate()
- {
- if (bypassTrigger) return;
- LeadRouter.routeToDealer(
- Select.Records.any(new List<Select.Filter> {
- LeadRouter.trialSentToCustomer(),
- LeadRouter.shouldReassign()
- }
- ).filter(newLeads, oldmap));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement