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

Problem with Merge Statement !!



I am trying to merge two lead records ,please find below the code. 


Lead leads= [SELECT Email,company, RFI_Record_Type__c FROM Lead
WHERE email IN:emailSet and Email !=null and Id not IN:leadIds Order By CreatedDate DESC Limit 1];

List<Lead> newLeads=[SELECT Email,company, RFI_Record_Type__c FROM Lead
WHERE Id IN:leadIds and Email !=null];

merge leads newleads;


Leads is the master record and newLeads is the duplicate/new records. Both the soql queries return a row , which is good. When I debug , it shows both are merged and the merged record deleted which is good. 


But When I again try to assert for the merged value by using a soql over leads as same as the first soql above, it returns the same old record but does not display any merged value. 


Any help would be nice to have . 


Thank You