• Ravi Kiran 143
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
My Code below, please advise which one is correct for bulk process update

(NOTE: Work_Email__c was formula field from the other object , so I need to update the Email__c field (Data type is Email)
// I would like keep the query out side because there may be high volume...please advise best coding design

Map<Id, Emp__c> eMap = new Map<Id, Emp__c>([SELECT Id, Email__c, Work_Email__c FROM Emp__c WHERE ID IN: XYZ);                    
for( Empl__c eachER : eMap.values() ){
    Emp__c emp = new Employment__c(id = eachER.id);
    emp.Email__c = eMap.get(emp.id).Work_Email__c;            //  Line 1 of code is Correct ?
    emp.Email__c = eMap.get(eachER.id).Work_Email__c;      //  Line 2 of code is Correct  ?


Thanks in advance
JR