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
pranavshahpranavshah 

how to compare two account if i changed ownership for account

Suppose i am writing a a trigger handler class on opportunity..
if for one opportunity i need to change the account owner,, how it will be done using trigger..
how can i compare old and new value.

i am trying to write in the following way..
please suggest

public void updateAccountowner(list<opportunity> opportunities, map<id, opportunity> mapoldopportunity)
   {
    for(Opportunity opp:opportunities)
   {
      if(mapoldopportunity.get(opp.id).Amount!=='' && opp.amount!=='')
     {
     
     }
   }
   }

 
Sunil Chandel 2Sunil Chandel 2
trigger.oldmap!= null && trigger.newmap!=trigger.oldmap