Guest User

Untitled

a guest
Jun 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. trigger updateDescClosedWon on Opportunity (after insert,after update) {
  2.  
  3. for ( Opportunity opp : Trigger.new ) {
  4.  
  5. List <OpportunityContactRole> OppCR = [SELECT ContactID FROM OpportunityContactRole WHERE OpportunityID = :opp.Id];
  6. for (OpportunityContactRole currentContact : OppCr) {
  7. if ( opp.StageName == 'Closed Won' ) {
  8.  
  9. List < Opportunity > oppList = [SELECT Id, Name FROM Opportunity WHERE Id IN
  10. (SELECT OpportunityId FROM OpportunityContactRole WHERE ContactId =: currentContact.Id)];
  11.  
  12. Contact newCount = [SELECT COUNT(Id) From Contact Where Id IN (SELECT ContactId FROM OpportunityContactRole)];
  13. }
  14.  
  15. }
Add Comment
Please, Sign In to add comment