• ats batch
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
trigger CreateClead on Lead(after insert){
    list<Id>deletLeadList=new list<Id>();
    if(Trigger.isInsert){
        List<Clead__c> cleadlst= new List <Clead__c>();
        for(Lead le: trigger.new){
            system.debug('==================='+le);
            if(le.LeadSource=='Job Application'){
                deletLeadList.add(le.id);
                Clead__c cl= new Clead__c ();
                cl.Name=le.LastName;
                cl.Email__c=le.Email;
                cl.Phone__c=le.Phone;
                cl.Job_Post__c=le.Subject__c;
                cl.Comments__c=le.Description;
                cl.CurrencyIsoCode='USD';
                cl.Reason__c='Available';
                cl.Status__c='Pre-Active';
                cl.Clead_Source__c='Web';
                //cl.Selling_Rate_Hr__c='Fiftydalor';
                //cl.Technology__c='SQL';
                cl.Role__c='Other';
                //cl.Current_Visa__c='H1';
                cleadlst.add(cl);
            }
        }
        insert cleadlst;
    }
    if(!deletLeadList.isEmpty())
        delete([SELECT Id FROM Lead WHERE ID IN:deletLeadList]);
}

 
trigger CreateClead on Lead(after insert){
    list<Id>deletLeadList=new list<Id>();
    if(Trigger.isInsert){
        List<Clead__c> cleadlst= new List <Clead__c>();
        for(Lead le: trigger.new){
            system.debug('==================='+le);
            if(le.LeadSource=='Job Application'){
                deletLeadList.add(le.id);
                Clead__c cl= new Clead__c ();
                cl.Name=le.LastName;
                cl.Email__c=le.Email;
                cl.Phone__c=le.Phone;
                cl.Job_Post__c=le.Subject__c;
                cl.Comments__c=le.Description;
                cl.CurrencyIsoCode='USD';
                cl.Reason__c='Available';
                cl.Status__c='Pre-Active';
                cl.Clead_Source__c='Web';
                //cl.Selling_Rate_Hr__c='Fiftydalor';
                //cl.Technology__c='SQL';
                cl.Role__c='Other';
                //cl.Current_Visa__c='H1';
                cleadlst.add(cl);
            }
        }
        insert cleadlst;
    }
    if(!deletLeadList.isEmpty())
        delete([SELECT Id FROM Lead WHERE ID IN:deletLeadList]);
}