Use Case : Lets say you have a requirement to copy modified field values from latest opportunity to Account , then how can you do field mapping effectively ? Assumptions: We are not using any flows here. Step - 1 Get all Account Ids from Opportunity Trigger/trigger helper Step -2 Query Account and Its related opportunity records, assume you want to define latest opportunity by LastStageChangeDate, you can use createdDate too. This will give account details and latest opportunity without the new values that has been modified. so this is basically old opportunity. private static List < Account > getAccounts ( set < id > accountIdset ){ return [ SELECT id , Field_1__c , Field_2__c , Field_3__c , Field_4__c , PersonEmail , Phone , ( SELECT id , Field_1__c , Field_2__c , Field_3__c , ...
A place where you have to land for exploring Salesforce