Created
December 20, 2020 14:25
-
-
Save shawon39/bca69dde35b051573fe779c6b9733d59 to your computer and use it in GitHub Desktop.
Apex Triggers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger DmlTriggerBulk on Account(after update) { | |
List<Opportunity> relatedOpps = [SELECT Id,Name,Probability FROM | |
Opportunity WHERE AccountId IN :Trigger.New]; | |
List<Opportunity> oppsToUpdate = new List<Opportunity>(); | |
for(Opportunity opp : relatedOpps) { | |
if ((opp.Probability >= 50) && (opp.Probability < 100)) { | |
opp.Description = 'New description for opportunity.'; | |
oppsToUpdate.add(opp); | |
} | |
} | |
update oppsToUpdate; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment