How to update related cases and fields from one recordtype to other recordtype in lead
问题 public class UpdaterecordtypeforLead { Public static void Leadtootherupdate() { List<Lead> OlderLead = [SELECT Id,Name, RecordTypeId from Lead where RecordType.Name = 'Enquiries']; List<Lead> NewLead = New List<Lead> (); If(NewLead.Id == null) { for( Lead l : OlderLead) { for(Lead l1 : NewLead) { l1.LastName = l.LastName; l1.Email= l.Email; NewLead.add(l1); NewLead.add(l1); Insert l1; } } If ( (l1. LastName == l.LastName && l1.Email == l.Email)) { NewLead.add(OlderLead.Related_Cases__c);