5 Antworten

I think I figured it out. Thanks for the code!
Trigger changeopp on Event(after update, after insert) {
string eid;
list<opportunity> oplist = new list<opportunity> ();
list<opportunity> opToUpdate = new list<opportunity> ();
for (event e: trigger.new) {
eid= e.whatid;
if(eid.startsWith('006')) {
oplist = [select name, stagename from opportunity where id=: eid and (stagename= 'Contacted' or stagename= 'Start - go for it!')];
}
}
for ( opportunity opp: oplist) {
opp.stagename = 'Appointment scheduled';
opToUpdate.add(opp);
}
update opToUpdate;
}