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
nitsnits 

Not able to update records

I have a stream of opportunities coming into the system.
I have a trigger that fires on update event.
 
Now for that I have to pick values for every opportunity from other object and update.
 
trigger Update_AdEntId on Opportunity (before insert) {
opportunity[] opp=trigger.new;
list<opportunity> oppupdate=new list<opportunity>();
// for(user[] uu:[select email from user where id :=opp.ownerid])
for(opportunity oppcount:opp){
user u=[select email from user where id=:oppcount.ownerid];
oppcount.name=u.email;
oppupdate.add(oppcount);
}
update oppupdate;
}
 
 
I am still getting error for two many DML statements. If I am missing somethg. Plz correct the code