
Thanks for your help!!!!
Error: Compile Error: unexpected token: '<' at line 1 column 8
trigger account_type on Account (before insert, before update) {
}trigger updateactive on account (after update){
opportunity__c[] cpstoupdate = new opportunity__c[]{};
for(account c : trigger.new ){
for(opportunity_c cp: [ select id,name,Closed_Won__c from stage__c whereaccount=:c.id]){
if ( c.Closed_Won__c != Type && cp._Customer__c ){
cp.Prospect__c == false;
}
cpstoupdate.add(cp);
}
}
if(cpstoupdate.size()>0)
update cpstoupdate;
}
6 个回答
You can do this without a trigger using a workflow. Create a rollup summary field at the Account. Make it a Count of opportunities. Add the Filter Critweria of Won = True. Then create a WFR that will update the Account Type field to customer when the rollup summary field > 0