You need to sign in to do that
Don't have an account?
Seth Partridge
How to get sobject list from Apex controller to output on a Visualforce page
Hi,
I'm trying to get an sObject list that I'm creating in my Apex controller to output on a VisualForce page, but nothing is appearing on my VisualForce page. Can you help? :)
Also, I can see debug logs for my Visualforce page, but not for the Apex controller. Is it possible to view Apex controller debug logs?
Thanks for your help!
Controller code
VF Page Code
I'm trying to get an sObject list that I'm creating in my Apex controller to output on a VisualForce page, but nothing is appearing on my VisualForce page. Can you help? :)
Also, I can see debug logs for my Visualforce page, but not for the Apex controller. Is it possible to view Apex controller debug logs?
Thanks for your help!
Controller code
public class OpportunityPDFController { public contact con{get;set;} public Opportunity opp{get;set;} public MAP_Submission__c mapsub{get;set;} public signature__signature__c sig; public String attachmentid { get; set; } //variable to add terms to in loop public List<Product_Agreement_Terms__c> signingterms{ get; set; } public OpportunityPDFController(Apexpages.StandardController controller){ Id oppId = ApexPages.currentPage().getParameters().get('parentid'); Id sigId = ApexPages.currentPage().getParameters().get('Id'); if(oppId<>null && sigId==null){ try{ opp=[select id,name,Rich_Terms__c,amount,account.name,account.Legal_Business_Name__c,account.billingstreet,account.billingcity,account.billingstate,account.billingcountry,account.billingpostalcode,Payment_Method__c,Credit_Card_Number__c,Credit_Card_Expiry_Date__c,CV_Code__c,Name_On_Card__c from opportunity where id=:oppId]; List<OpportunityLineItem> l_co = [SELECT Id, Product2Id FROM OpportunityLineItem WHERE OpportunityId = :opp.Id]; Set<Id> products= new Set<Id>(); for(OpportunityLineItem am_co : l_co) { if (products.contains(am_co.Product2Id)) { system.debug('product Found'); } else{ products.add(am_co.Product2Id); system.debug('Product missing loop id added: ' + products); } } //Create Sku tracking variable product2 sku = new product2(); //Create Product Agreement Terms Set variable Set<Id> pats= new Set<Id>(); for(Id pId : products) { product2 p = [SELECT Product_Agreement_Terms__c, ProductCode FROM Product2 WHERE Id = :pId ]; //asign loop varaible to outer variable sku = p; system.debug('p PID = ' + p.Product_Agreement_Terms__c); system.debug('p Sku = ' + p.ProductCode); if (pats.contains(p.Product_Agreement_Terms__c)) { system.debug('Product Terms Found: ' + p.ProductCode); } else{ pats.add(p.Product_Agreement_Terms__c); system.debug('Product terms missing loop id added: ' + pats + ' ' + p.ProductCode); } } //review set of terms and compile them in the terms variable ---- Loop to add only MACP for(String patId : pats) { //Create a new ProductAgreementTerms variable Product_Agreement_Terms__c t = [SELECT Id,Rich_Terms__c,Understand_Checkbox_Required__c FROM Product_Agreement_Terms__c WHERE ID =:patId]; //Update terms variable with existing terms, line break, and new terms if (sku.ProductCode=='MACP') { signingterms.add (t); system.debug('t = ' + t + ' and signingterms = ' + signingterms); } else {} } //review set of terms and compile them in the terms variable ---- Loop to add only MAPI for(String patId : pats) { //Create a new ProductAgreementTerms variable Product_Agreement_Terms__c t = [SELECT Id,Rich_Terms__c,Understand_Checkbox_Required__c FROM Product_Agreement_Terms__c WHERE ID =:patId]; //Update terms variable with existing terms, line break, and new terms if (sku.ProductCode=='MAPI') { signingterms.add (t); system.debug('t = ' + t + ' and signingterms = ' + signingterms); } else {} } //review set of terms and compile them in the terms variable ---- Loop to add everything else for(String patId : pats) { //Create a new ProductAgreementTerms variable Product_Agreement_Terms__c t = [SELECT Id,Rich_Terms__c,Understand_Checkbox_Required__c FROM Product_Agreement_Terms__c WHERE ID =:patId]; //Update terms variable with existing terms, line break, and new terms signingterms.add (t); system.debug('t = ' + t + ' and signingterms = ' + signingterms); } } catch(Exception e){system.debug('$$$Exception :'+e);} try{ mapsub=[select id,name,Client_Contact__r.name,Client_Email__c,Client_Phone_1__c ,Client_Phone_1_Ext__c,Invoice_Recipient__r.name,Invoice_Recipient_Email__c,Invoice_Recipient_Phone__c,Invoice_Recipient_Phone_Extension__c,Map_Link__c from MAP_Submission__c where MAP_Opportunity__c=:opp.id]; } catch(Exception e){system.debug('$$$Exception :'+e);} }
VF Page Code
<apex:page standardController="signature__Signature__c" extensions="OpportunityPDFController" id="pg" docType="html-5.0" standardStylesheets="true"> <!-- other code preceeding this trimmed -- <apex:repeat value="{!signingterms}" var="term" id="theRepeat"> <apex:outputText value="{!term.Rich_Terms__c}" id="theValue" escape="false" /><br/> <apex:form> <apex:inputCheckbox label="I understand and agree" rendered="{!term.Understand_Checkbox_Required__c!=False}" /> </apex:form> </apex:repeat>