Skip to content

Instantly share code, notes, and snippets.

@sfdcfanboy
Last active October 13, 2017 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sfdcfanboy/bb6a98fa7f9cf70d71b6d4160e8166a2 to your computer and use it in GitHub Desktop.
Save sfdcfanboy/bb6a98fa7f9cf70d71b6d4160e8166a2 to your computer and use it in GitHub Desktop.
global with sharing class OppsWithMatches{
global List<Opportunity> Opps{get;set;}
global String accountId{get;set;}
global account account{
get {
Account = [Select Id, name from Account where id =: accountId];
return account; }
set;
}
global OppsWithMatches(){
}
global List<Opportunity> Opps{
get{
posToDisplay = new List<Opportunity>();
List<Opportunity> oppList = [SELECT Id,Name,Description,Amount,(SELECT Id,Name,Email__c FROM Matches__r) FROM Opportunity WHERE AccountId=:accountId];
for(Opportunity p:oppList){
Boolean display = false;
for(Match__c m:p.matches__r){
if(m.status__c == 'Confirmed'){
display = true;
}
}
if(display==true){
posToDisplay.add(p);
}
}
return posToDisplay;
}
set;
}
global String NewLine {
get { return '\r\n'; }
set;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment