You need to sign in to do that
Don't have an account?
Peter Martensen 8
Need help adding another exclusion to a Class
I have a Class that sends an email when an Opportunity is Closed Won and if the Line_of_Service__c does not contain “Agawam”. I need to add “Whippany” and “Mirabel” to that exclusion. Can someone help me modify this code to exclude those also?
List<Opportunity> oppsThatGetAlerts = new List<Opportunity>(); for( Opportunity o : updatedOpportunities ) { // 11-08-2016 jhm: If the Opp just went to Closed Won and it's from Durham, NC or Longmount, CO, Edinburgh we want to send an alert. if( ('Closed Won' == o.StageName) && ('Closed Won' != opportunityOldMap.get(o.Id).StageName) && (!o.Line_of_Service__c.contains('Agawam') ) ) { System.debug('*******'); oppsThatGetAlerts.add( o ); } } if( 0 < oppsThatGetAlerts.size() ) { sendOppAlerts( oppsThatGetAlerts ); }
All Answers
Hi Peter,
You can do it easily like below;
Short brief; first defining all exclude list,
then making your current value similar to them,
and comparison with indexOf.