• Kajal Singh 36
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 21
    Replies
We can change the value from very hot to hot, Very hot to warm but cannot change the value hot to warm in rating field for lead status picklist site vist done... 

Thanks!!!! 
This trigger is to prevent for duplication...
trigger LeadDuplicate on Lead__c (before insert) {
   List<Lead__c> accList=new List<Lead__c>([select Email__c, Name__c, Phone_No__c from Lead__c]);
    map<String,Lead__c> accmap=new map<String,Lead__c>();
    for(Lead__c acc:accList){
        accmap.put(acc.Email__c,acc);
        accmap.put(acc.Phone_No__c,acc);
        
    }
     
    
    //For Insert Operation
    if(Trigger.isinsert&&Trigger.isbefore){
        for(Lead__c acc:Trigger.new){
            if(accmap.get(acc.Email__c)!=null || accmap.get(acc.Phone_No__c)!=null){
                acc.adderror('Duplicate Lead exists');
            }
        }
    }
}
-------------------------------------------------------------------------------

This trigger is for copy the lead
This is the handler Class
public class LeadTriggerHelper {
        public static void insertLead(List <Lead> leadList) {
            List<Lead__c> newLeadsList = new List<Lead__c>();
            for(Lead ld: leadlist) {
                Lead__c newLead = new Lead__c();
                newLead.Name__c = ld.LastName;
                newLead.Phone_No__c = ld.Phone;
                newLead.Email__c = ld.Email;
                 newLead.City__c = ld.City;
                newLead.State__c = ld.State;
                newLead.Lead_Status__c = ld.Status;
                newLead.Company__c = ld.Company; 
                newLead.Pincode__c = ld.PostalCode;
                newLead.Country__c = ld.Country;
                newLead.OwnerId = ld.OwnerId;
                newLeadsList.add(newLead);        
            }
            insert newLeadsList;
        }
    }

Trigger
trigger ObjTrigger on Lead (after insert) {
  LeadTriggerHelper.insertLead(Trigger.new);
    
}
--------------------------------------------------------
How can i write this in a single handler and a single trigger
We can change the value from very hot to hot, Very hot to warm but cannot change the value hot to warm in rating field for lead status picklist site vist done... 

Thanks!!!! 
This trigger is to prevent for duplication...
trigger LeadDuplicate on Lead__c (before insert) {
   List<Lead__c> accList=new List<Lead__c>([select Email__c, Name__c, Phone_No__c from Lead__c]);
    map<String,Lead__c> accmap=new map<String,Lead__c>();
    for(Lead__c acc:accList){
        accmap.put(acc.Email__c,acc);
        accmap.put(acc.Phone_No__c,acc);
        
    }
     
    
    //For Insert Operation
    if(Trigger.isinsert&&Trigger.isbefore){
        for(Lead__c acc:Trigger.new){
            if(accmap.get(acc.Email__c)!=null || accmap.get(acc.Phone_No__c)!=null){
                acc.adderror('Duplicate Lead exists');
            }
        }
    }
}
-------------------------------------------------------------------------------

This trigger is for copy the lead
This is the handler Class
public class LeadTriggerHelper {
        public static void insertLead(List <Lead> leadList) {
            List<Lead__c> newLeadsList = new List<Lead__c>();
            for(Lead ld: leadlist) {
                Lead__c newLead = new Lead__c();
                newLead.Name__c = ld.LastName;
                newLead.Phone_No__c = ld.Phone;
                newLead.Email__c = ld.Email;
                 newLead.City__c = ld.City;
                newLead.State__c = ld.State;
                newLead.Lead_Status__c = ld.Status;
                newLead.Company__c = ld.Company; 
                newLead.Pincode__c = ld.PostalCode;
                newLead.Country__c = ld.Country;
                newLead.OwnerId = ld.OwnerId;
                newLeadsList.add(newLead);        
            }
            insert newLeadsList;
        }
    }

Trigger
trigger ObjTrigger on Lead (after insert) {
  LeadTriggerHelper.insertLead(Trigger.new);
    
}
--------------------------------------------------------
How can i write this in a single handler and a single trigger
Hi guys.. I want to integrate facebook on salesforce.i want to know the process regarding this.
I want to fetch some data regaring the user..
pls tell me what things are required as i am using REST api.