Skip to content

Instantly share code, notes, and snippets.

@TheShubhamVsnv
Created June 30, 2021 12:50
Show Gist options
  • Save TheShubhamVsnv/e97a3c863f5597a0f92deb5996bd62a8 to your computer and use it in GitHub Desktop.
Save TheShubhamVsnv/e97a3c863f5597a0f92deb5996bd62a8 to your computer and use it in GitHub Desktop.
When an Opportunity is greater than $20k, mark is_gold to TRUE
trigger TriggerExample4 on Account (After Update) {
integer amount=20000;
For(Account acc:trigger.new){
List<opportunity> opps=[select id from opportunity where Account.id=:acc.id And Amount > 20000];
If(opps.size()>0){
acc.Is_Gold__c=True;
}Else{
acc.Is_Gold__c=False;
}
update acc;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment