function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NishhNishh 

Trigger fires when lead assignment rule matches the criteria

I have 2 queues on lead object 1. Custom assignment queue  2. Trask Queue

 

when queue is Custom assignment queue then trigger fires and matches Account with lead's company name field and if single match found then lead converted to contact.

 

And if it found multiple matches with account and company name then it will go to trask queue

 

Any help?

Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan

Hi Nishh,

 

Try the following trigger to acheive this,

 

trigger CheckQueuesToConvert on Lead (after insert, after update) {
    for(Lead l: Trigger.New){

     if(l.ownerId == <Custom assignment queue>){
        List<Account> acc = [select id,name from Account where Name =: l.Company];
        if(accList.Size() > 0){
           if(accList.Size() == 1){
               //Your Lead Convert statement here
           }
           else{
               l.ownerId = <Trask Queue ID> ;
           } 

         }         
       }
    }
}

 

 

Hope this will help you...!

 

Please don't forget to give kudos and mark this as a solution, if this works out.