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.
If we merge a merged record with master record , then will all the fields on the merged record get copied into the master record ?
Any help would be nice to have.
Thank You
leadIds
andemailSet
being populated.