Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trigger LedTrigger on Lead (after insert,after update) {
- map<string, Lead> ObjMap = new map<string, Lead>();
- List<lead> leadList=new list<lead>();
- for(lead l:trigger.new){
- if(l.status==Active){
- ObjMap.put(l.LeadTerritory__c,l);
- //leadList.add(l);
- }
- List<Custom_Object> LeadR = [SELECT Id, QueueName__c, Territory__c
- FROM Lead_Routing__c WHERE LeadTerritory__c IN :ObjMap.KeySet()];
- for(Lead ld:ObjMap.values()){
- if(LeadR.)
- ld.ownerid=
- }
- }
- }
- trigger LedTrigger on Lead (after insert,after update) {
- map<string, Lead> ObjMap = new map<string, Lead>();
- List<lead> leadList=new list<lead>();
- for(lead l:trigger.new){
- if(l.status==Active){
- ObjMap.put(l.LeadTerritory__c,l);
- //leadList.add(l);
- }
- }
- List<Custom_Object> LeadR = [SELECT Id, QueueName__c, Territory__c
- FROM Lead_Routing__c
- WHERE LeadTerritory__c IN :ObjMap.KeySet()];
- Group queueGrp = new Group();
- if(!LeadR.isEmpty()){
- queueGrp = [Select Id from Group where Type = 'Queue' AND Name = : LeadR[0].QueueName__c LIMIT 1];
- }
- for(Lead ld:ObjMap.values()){
- if(queueGrp != null)){
- ld.ownerid=queueGrp.Id;
- }
- }
- }
Add Comment
Please, Sign In to add comment