You need to sign in to do that
Don't have an account?
sfdev1
Trigger on Opportunity that update the Account Object
I have created a custom field called 'Status' on the Account object. I has three picklist values : Prospect, Active and Dormant
The default is Propects' I an Opportunity is Closed -Won then I want to update the Account.Status field to Active
I started with the following code
public class OpportunityUpdateClass{
public stats void UpdateAccountStatustoActive(Opportunity[] opps){
Map<String,Opportunity> oppMap = new Map<String,Opportunity>();
for (Opportunity opp:opps){
Account accounts = [select id,name,industry from account where id in :opp.accountid];
for (Account acc: accounts){
if (acc.status__c != 'Active'){
acc.staus__C = 'Active'
}
Map<String,Opportunity> oppMap = new Map<String,Opportunity>();
for (Opportunity opp:opps){
Account accounts = [select id,name,industry from account where id in :opp.accountid];
for (Account acc: accounts){
if (acc.status__c != 'Active'){
acc.staus__C = 'Active'
}
}
}
}
}
}
Thanks for the code.
I tried to compile it but I'm getting this error :