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
Avinash dhanke 24Avinash dhanke 24 

one lookup filed in my lead object i want to populated this lookup filed in text field in same object. i will write the handler for that below is my code

 public static void populatedLookup(Lead leadobj1){
       Id recordTypeId1 = Schema.Sobjecttype.Lead.getRecordTypeInfosByName().get('IM-Onboarding').getRecordTypeId();
       Id recordTypeId2 = Schema.Sobjecttype.Lead.getRecordTypeInfosByName().get('IM Onboarding-QDE').getRecordTypeId();
      List<Lead> leadList=[Select Id,FirstName,LastName,PAN__c,Stage__c,Status,Client_Type__c,Channel_Partner__c,Channel__c,RecordType.Name FROM Lead Where
                            (RecordType.Name=:recordTypeId1 OR RecordType.Name =:recordTypeId1) And Id =:leadObj1.id];   
            For(lead leadObj:leadList){
                if(leadObj.Channel_Partner__c!=null){
                    leadObj.Channel_Partner__c=leadObj.Channel__c;
                }
            }
        }