You need to sign in to do that
Don't have an account?
SOQL List Return not appearing in Logs/VF page
I have used this wrapper class design pattern before successfully but this time it is not returning my list. I have ran the SOQL query on the workbench successfully and returned results. When I look at the logs I only see one SOQL query when there should be two (first on the opportunity object and then on the Feature_Request__c object). What issue am I running into here? Thanks in advance!
Apex:
Visualforce Page:
Apex:
public with sharing class FeatReqOppJunctionExtension { public Opportunity theOpp {get; set;} public Feature_Request__c FeaReq {get; set;} public Opportunity_Feature_Request__c oppFR {get; set;} public List<ofrJO> featReqList {get; set;} public FeatReqOppJunctionExtension(ApexPages.StandardController controller) { String oppId = ApexPages.currentPage().getParameters().get('oppId'); theOpp = [select Id from Opportunity where Id =:oppId limit 1]; } public List<ofrJO> getFeatReq() { if(featReqList == null) { featReqList = new List<ofrJO>(); for(Feature_Request__c fr: [select Id, Name, Description_of_Request__c from Feature_Request__c ]) { featReqList.add(new ofrJO(fr)); } } return featReqList; } public PageReference insertRec() { for(ofrJO freq: getFeatReq()) { if(freq.selected == true) { Opportunity_Feature_Request__c OppFeatReq = new Opportunity_Feature_Request__c(); OppFeatReq.Opportunity__c = theOpp.Id; OppFeatReq.Feature_Request__c = freq.oppFR.Id; //OppFeatReq.add(nal); insert OppFeatReq; } } return new PageReference('/apex/quoteEditAssociatedSite?quoteId='+ApexPages.currentPage().getParameters().get('quoteId')); } public class ofrJO { public Feature_Request__c FeaReq {get; set;} public Opportunity opp {get; set;} public Opportunity_Feature_Request__c oppFR {get; set;} public Boolean selected {get; set;} public ofrJO(Feature_Request__c fr){ FeaReq = fr; selected = false; } public ofrJO(Opportunity o){ opp = o; } public ofrJO(Opportunity_Feature_Request__c ofr){ oppFR = ofr; } } }
Visualforce Page:
<apex:page StandardController="Opportunity_Feature_Request__c" extensions="FeatReqOppJunctionExtension"> <apex:includescript value="//code.jquery.com/jquery-1.11.1.min.js" / > <apex:includescript value="//cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js" /> <apex:stylesheet value="//cdn.datatables.net/1.10.4/css/jquery.dataTables.css" /> <script> j$ = jQuery.noConflict(); j$(document).ready( function () { var contactTable = j$('[id$="table"]').DataTable({ }); }); </script> <apex:form> <apex:pageBlock> <apex:pageBlockButtons> </apex:pageBlockButtons> <!-- In our table we are displaying the cContact records --> <apex:pageBlockTable value="{!featReqList}" var="ofr" id="table" style="tablesorter"> <apex:column headerValue="Action"> <!-- This is our selected Boolean property in our wrapper class --> <apex:commandButton value="{!ofr.selected}"/> </apex:column> <!-- This is how we access the contact values within our cContact container/wrapper --> <apex:column value="{!ofr.FeaReq.Name}" /> <apex:column value="{!ofr.FeaReq.Description_of_Request__c}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>