• Pankaj Parihar
  • NEWBIE
  • 30 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 10
    Replies
hello friends 
can any one tell me the proper code for Merging duplicate records, i have merged files but not able to delete duplicate files.
global class batch3 implements Database.Batchable<sObject> {
    
    global Database.QueryLocator start(Database.BatchableContext BC) {
 		
        String query = 'SELECT Id,Name,Name__c,MobilePhone,Email,AnnualRevenue,LeadSource FROM Lead';
        return Database.getQueryLocator(query);
      
    }
    global void execute(Database.BatchableContext BC, List<Lead> leadlist) 
    {
        for( Lead a : leadlist)
       {
           for(Lead b: leadlist)
           { 
          		if(a.Name__c == b.Name__c )
                {
                    if(a.MobilePhone== null)
                    {
                        a.MobilePhone=b.MobilePhone;
                    }
                    if(a.Email== null)
                    {
                        a.Email=b.Email;
                    }
                    if(a.AnnualRevenue== null)
                    {
                        a.AnnualRevenue=b.AnnualRevenue;
                    }
                    if(a.LeadSource== null)
                    {
                        a.LeadSource=b.LeadSource;
                    }
                    //delete  b;
                    //[select id from Lead where Name__c='b.Name__c'];
                   	/* Lead[] dlist1 = [SELECT Id, Name FROM Lead WHERE Name__c = 'b.Name__c']; 
						try 
                        {
    						delete dlist1;
						}
                    	catch (DmlException e) 
                        {
    						// Process exception here
						}
					*/
               }
             	
           }
          // update a;
       }
      /* 	system.debug('leadlist a>>>>>'+leadlist);
        system.debug('outside loop>>>>>');
        list<lead> list1=new list<lead>();
      for( Lead a : leadlist)
       {
           for(Lead b: leadlist)
           {
          		if(a.Name__c != b.Name__c )
                {
                   list1.add(a);
                }
               else
                {
                    
                }
           }
           update a;
       }
       // List<Lead> list2 = new List<Lead>(list1);
        */  update leadlist;
        
    }   
     
    global void finish(Database.BatchableContext BC) {
      
  }
}
plz correct in this.
 
Hi friends
i want a trigger code for this
When a contact is made primary(1) the city of the contact should be updated in the Account’s city(3) field. User-added image
User-added image
hi friends 
i wanted to acess date and time  separately how can i get it
through batch code
Remind the opportunity owner and senior management when the close date is approaching for a large deal, an opportunity that has an amount greater than $100,000. Also, create a follow-up task for the opportunity owner if the deal is still open when the close date passes.
hello friends 
plz help me with the code.
Based on the probability, calculate the amount for each product and display the amount.
Display the cumulative amount in Opportunity object only if the cumulative probability has crossed 50%.
Hi All
Notify the VP of Sales when a deal is lost if the stage was “Proposal/Price Quote” and the amount was greater than $1,000,000. plz help me in steps how to do code if required..
plz help with code
Merging duplicate records in leads based on first name and last name. Batch should run every day.
 
product table
hello 
i need to display this table on vf page on a button click which is inside of an opportunity record.
plz help me with code.