You need to sign in to do that
Don't have an account?

show Custom Related list from a Custom Object in a visualforce page that is in a community
Hello i am trying to show Custom Related list from a Custom Object in a visualforce page that is in a community. I believe i have everything right but the fields are not showing or retreiving anything for the last two page blocks here is my code
<apex:page controller="CommunityProjectController" showHeader="false" sidebar="false">
<apex:composition template="CommunityPageTemplate">
<apex:define name="bodyContent">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!thisProject}" var="item" columns="6">
<apex:column headerValue="Project Name">
<apex:outputLink value="/apex/SMBCommunityProject?Projectid={!item.id}">{!item.Name}</apex:outputLink>
</apex:column>
<apex:column value="{!item.Area__c}"/>
<apex:column value="{!item.Project_Sub_Class__c}"/>
<apex:column value="{!item.Status__c}"/>
<apex:column value="{!item.Technical_Lead__c}"/>
<apex:column value="{!item.Primary_Contact__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockTable value="{!thisProject}" var="item" columns="5">
<apex:column value="{!item.Budget__c}"/>
<apex:column value="{!item.Contingency__c}"/>
<apex:column value="{!item.Total_Budget__c}"/>
<apex:column value="{!item.Total_Invoiced__c}"/>
<apex:column value="{!item.Budget_Remaining__c}"/>
</apex:pageBlockTable>
</apex:pageblock>
<apex:pageBlock >
<apex:pageBlockTable value="{!invoices}" var="item" columns="6">
<apex:column >
<apex:outputLink value="/apex//apex/printableinvoice?id={!item.id}" >{!item.Name}</apex:outputLink>
</apex:column>
<apex:column value="{!item.Invoice_Date__c}"/>
<apex:column value="{!item.Payment_Terms__c}"/>
<apex:column value="{!item.Invoice_Due_Date__c}"/>
<apex:column value="{!item.Invoice_Total__c}"/>
<apex:column value="{!item.Status__c}"/>
<apex:column value="{!item.Project__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockTable value="{!changeOrders}" var="item" columns="6">
<apex:column value="{!item.name}" />
<apex:column value="{!item.Status__c}"/>
<apex:column value="{!item.Amount__c}"/>
<apex:column value="{!item.Date_Requested__c}"/>
<apex:column value="{!item.Date_Approved__c}"/>
<apex:column value="{!item.Approval_Method__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:define>
</apex:composition>
</apex:page>
--------------------------------------------------------------------------------------------------------------------------------------
/*
This class will handle grabbing a passed in projectid as a url parameter, then display the info
*/
public with sharing class CommunityProjectController{
public Project__c thisProject {get;set;}
public List<Change_Order__c> changeOrders {get;set;}
public List<Invoice__c> invoices {get;set;}
public String thisProjectId {get;set;}
public CommunityProjectController()
{
//get our projectId parameter, use it to query for our project and set it to "thisProject"
thisProjectId = ApexPages.currentPage().getParameters().get('projectId');
thisProject = [SELECT id, name, Area__c, Project_Sub_Class__c, Status__c, Technical_Lead__c, Primary_Contact__c,
Budget__c, Contingency__c, Total_Budget__c, Total_Invoiced__c, Budget_Remaining__c FROM Project__c WHERE id =: thisProjectId];
changeOrders = [SELECT id, Name, Status__c, Amount__c, Date_Requested__C, Date_Approved__c, Approval_Method__c FROM Change_Order__c WHERE id =:thisProjectId];
for(Change_Order__c currentChangeOrder : changeOrders)
{
}
invoices = [SELECT id, Name, Invoice_Date__c, Payment_Terms__c, Invoice_Due_Date__c, Invoice_Total__c, Status__c, Project__c FROM Invoice__c WHERE id =: thisProjectId];
for(Invoice__c currentInvoice : invoices)
{
}
}
}
<apex:page controller="CommunityProjectController" showHeader="false" sidebar="false">
<apex:composition template="CommunityPageTemplate">
<apex:define name="bodyContent">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!thisProject}" var="item" columns="6">
<apex:column headerValue="Project Name">
<apex:outputLink value="/apex/SMBCommunityProject?Projectid={!item.id}">{!item.Name}</apex:outputLink>
</apex:column>
<apex:column value="{!item.Area__c}"/>
<apex:column value="{!item.Project_Sub_Class__c}"/>
<apex:column value="{!item.Status__c}"/>
<apex:column value="{!item.Technical_Lead__c}"/>
<apex:column value="{!item.Primary_Contact__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockTable value="{!thisProject}" var="item" columns="5">
<apex:column value="{!item.Budget__c}"/>
<apex:column value="{!item.Contingency__c}"/>
<apex:column value="{!item.Total_Budget__c}"/>
<apex:column value="{!item.Total_Invoiced__c}"/>
<apex:column value="{!item.Budget_Remaining__c}"/>
</apex:pageBlockTable>
</apex:pageblock>
<apex:pageBlock >
<apex:pageBlockTable value="{!invoices}" var="item" columns="6">
<apex:column >
<apex:outputLink value="/apex//apex/printableinvoice?id={!item.id}" >{!item.Name}</apex:outputLink>
</apex:column>
<apex:column value="{!item.Invoice_Date__c}"/>
<apex:column value="{!item.Payment_Terms__c}"/>
<apex:column value="{!item.Invoice_Due_Date__c}"/>
<apex:column value="{!item.Invoice_Total__c}"/>
<apex:column value="{!item.Status__c}"/>
<apex:column value="{!item.Project__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockTable value="{!changeOrders}" var="item" columns="6">
<apex:column value="{!item.name}" />
<apex:column value="{!item.Status__c}"/>
<apex:column value="{!item.Amount__c}"/>
<apex:column value="{!item.Date_Requested__c}"/>
<apex:column value="{!item.Date_Approved__c}"/>
<apex:column value="{!item.Approval_Method__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:define>
</apex:composition>
</apex:page>
--------------------------------------------------------------------------------------------------------------------------------------
/*
This class will handle grabbing a passed in projectid as a url parameter, then display the info
*/
public with sharing class CommunityProjectController{
public Project__c thisProject {get;set;}
public List<Change_Order__c> changeOrders {get;set;}
public List<Invoice__c> invoices {get;set;}
public String thisProjectId {get;set;}
public CommunityProjectController()
{
//get our projectId parameter, use it to query for our project and set it to "thisProject"
thisProjectId = ApexPages.currentPage().getParameters().get('projectId');
thisProject = [SELECT id, name, Area__c, Project_Sub_Class__c, Status__c, Technical_Lead__c, Primary_Contact__c,
Budget__c, Contingency__c, Total_Budget__c, Total_Invoiced__c, Budget_Remaining__c FROM Project__c WHERE id =: thisProjectId];
changeOrders = [SELECT id, Name, Status__c, Amount__c, Date_Requested__C, Date_Approved__c, Approval_Method__c FROM Change_Order__c WHERE id =:thisProjectId];
for(Change_Order__c currentChangeOrder : changeOrders)
{
}
invoices = [SELECT id, Name, Invoice_Date__c, Payment_Terms__c, Invoice_Due_Date__c, Invoice_Total__c, Status__c, Project__c FROM Invoice__c WHERE id =: thisProjectId];
for(Invoice__c currentInvoice : invoices)
{
}
}
}
All Answers
What if you go "without sharing" ? does the profile you are using have read access on the objects/fields/records you are trying do query and display ?
Jerome