• econtractorpro
  • NEWBIE
  • 75 Points
  • Member since 2013

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies

SUMMARY
I have signed up for the Salesforce Partner Program and have created a managed app called ABC Company using my Partner Developer Edition account (dev org).

The app consists of one parent custom object (Project__c) and two child custom objects (Sent_item__c & Received_item__c).

I have a visualforce PDF page that displays the Project Summary with the Sent and Received related lists. For this VF PDF Page I have created an Apex Class that sorts/orders the list by Name ASC for Sent and Received Related Lists. I also have an apex test class with 100% code coverage.

The Generate Visualforce PDF Page works without any problems in my Partner Developer Edition account (dev org).

PROBLEM
After successful installation of my app on my Enterprise/Platform Edition account (Test Org) as a managed app I receive the following error when I try to generate the VF page:

common.apex.runtime.impl.ExecutionException: SObject row was retrieved via SOQL without querying the requested field:ecpfinal__Project__c.Name

(The error only occurs in my managed solution when installed on another Enterprise/Platform Edition account (Test Org))

Can you provide the necessary code to fix this error? Do I need to add additional code to the apex class?

VISUALFORCE PDF PAGE (Project_Summary)
<apex:page standardController="Project__c" sidebar="false" showHeader="false" renderAs="pdf" extensions="ProjectSummaryPDFController">
<hr></hr>
   <h3>PROJECT SUMMARY</h3>
<hr></hr>
 <table  style="width: 100%;">
<tr><td style="width: 25%;">Project Number:</td><td style="width: 75%;">{!Project__c.Name}</td></tr>
<tr><td style="width: 25%;">Project Name:</td><td style="width: 75%;">{!Project__c.Project_Name__c}</td></tr>
<tr><td style="width: 25%;">Contractor:</td><td style="width: 75%;">{!Project__c.Contractor__c}</td></tr>
 </table>
 <hr></hr>
   <b>SENT ITEMS</b>
<hr></hr>
<apex:dataTable value="{!cvSentItemLineItemsSorted}" var="item" border="1" cellpadding="3" width="100%" >
<apex:column >
<apex:facet name="header">Item Number</apex:facet>
<apex:outputText value="{!item.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Description</apex:facet>
<apex:outputText value="{!item.Description__c}"/>
</apex:column>
 </apex:datatable>
<hr></hr>
   <b>RECIEVED ITEMS</b>
<hr></hr>
 <apex:dataTable value="{!cvReceivedItemLineItemsSorted}" var="item" border="1" cellpadding="3" width="100%" >
<apex:column >
<apex:facet name="header">Item Number</apex:facet>
<apex:outputText value="{!item.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Description</apex:facet>
<apex:outputText value="{!item.Description__c}"/>
</apex:column>
 </apex:datatable>
  <hr></hr>
</apex:page>


APEX CLASS
public with sharing class ProjectSummaryPDFController {
       //set up the class variables we'll need to reference from VF page
       public List<Sent_item__c> cvSentItemLineItemsSorted {public get; private set;}
       public List<Received_item__c> cvReceivedItemLineItemsSorted {public get; private set;}
       
       //variable to hold current Project__c record
       private Project__c cvSelectedProject = null;
       
       //constructor
       public ProjectSummaryPDFController(ApexPages.StandardController pCntrllr)
       {
               // grab current Project__c record from the Standard Controller
               cvSelectedProject = (Project__c)pCntrllr.getRecord(); 
                       
               // build sorted List of Sent_item__c records for current Project__c
               cvSentItemLineItemsSorted = new List<Sent_item__c>();
               cvSentitemLineItemsSorted = 
                       [Select item.Name,
                               item.Description__c
                        From Sent_item__c item
                        Where item.Project_Number__c =: cvSelectedProject.id
                        ORDER BY item.Name ASC
                        limit 1000];
               
               // build sorted List of Received_item__c records for current Project__c
               cvReceivedItemLineItemsSorted = new List<Received_item__c>();
               cvReceivedItemLineItemsSorted = 
                       [Select item.Name, 
                               item.Description__c
                        From Received_item__c item
                        Where item.Project_Number__c =: cvSelectedProject.id
                        ORDER BY item.Name ASC
                        limit 1000];                         
       }     
}


APEX TEST CLASS
@isTest
private class testProjectSummaryPDFController {

   static testMethod void myUnitTest() {
        
       // make a valid Project__c record we will sent to PDF controller
       Project__c lvProject = makeValidProject();
       
       // make a Sent_item__c record for the project
       Sent_item__c lvSentItemObj = makeSentItemObj(lvProject);
       
       // make a Received_item__c record for the project
       Received_item__c lvReceivedItemObj = makeReceivedItemObj(lvProject);
       
       // first get the standard controller for my object and pass in the Project obj
       ApexPages.StandardController lvStdCntrllr = new ApexPages.standardController(lvProject);

       // now create an instance of my controller
       ProjectSummaryPDFController controller = new ProjectSummaryPDFController(lvStdCntrllr);

   }
       
static private Project__c makeValidProject() {
       // create Test Project record 
       Project__c lvProj = new Project__c();
       lvProj.Name = 'Name';
   lvProj.Project_name__c = 'Project Name';
       lvProj.Contractor__c = 'Contractor';
       
       insert lvProj; 
       
       return lvProj;
   }
   
   static private Sent_item__c makeSentItemObj(Project__c pProj) {
       Sent_Item__c lvObj = new Sent_Item__c();
       lvObj.Name = 'Name';
       lvObj.Description__c = 'Description';
       lvObj.Project_Number__c = pProj.Id;
       
       insert lvObj; 
       
       return lvObj;
   }
   
   static private Received_item__c makeReceivedItemObj(Project__c pProj) {
       Received_item__c lvObj = new Received_item__c();
       lvObj.Name = 'Name';
       lvObj.Description__c = 'Description';
       lvObj.Project_Number__c = pProj.Id;
       
       insert lvObj; 
       
       return lvObj;

   }
}

 

 

SUMMARY
I have signed up for the Salesforce Partner Program and have created a managed app called ABC Company using my Partner Developer Edition account (dev org).

The app consists of one parent custom object (Project__c) and two child custom objects (Sent_item__c & Received_item__c).

I have a visualforce PDF page that displays the Project Summary with the Sent and Received related lists. For this VF PDF Page I have created an Apex Class that sorts/orders the list by Name ASC for Sent and Received Related Lists. I also have an apex test class with 100% code coverage.

The Generate Visualforce PDF Page works without any problems in my Partner Developer Edition account (dev org).

PROBLEM
After successful installation of my app on my Enterprise/Platform Edition account (Test Org) as a managed app I receive the following error when I try to generate the VF page:

common.apex.runtime.impl.ExecutionException: SObject row was retrieved via SOQL without querying the requested field:ecpfinal__Project__c.Name

(The error only occurs in my managed solution when installed on another Enterprise/Platform Edition account (Test Org))

Can you provide the necessary code to fix this error? Do I need to add additional code to the apex class?

I am available through Skype and would like to drop in the code in real time through Skype with screen share or another similar method..

 

 

VISUALFORCE PDF PAGE (Project_Summary)
<apex:page standardController="Project__c" sidebar="false" showHeader="false" renderAs="pdf" extensions="ProjectSummaryPDFController">
<hr></hr>
   <h3>PROJECT SUMMARY</h3>
<hr></hr>
 <table  style="width: 100%;">
<tr><td style="width: 25%;">Project Number:</td><td style="width: 75%;">{!Project__c.Name}</td></tr>
<tr><td style="width: 25%;">Project Name:</td><td style="width: 75%;">{!Project__c.Project_Name__c}</td></tr>
<tr><td style="width: 25%;">Contractor:</td><td style="width: 75%;">{!Project__c.Contractor__c}</td></tr>
 </table>
 <hr></hr>
   <b>SENT ITEMS</b>
<hr></hr>
<apex:dataTable value="{!cvSentItemLineItemsSorted}" var="item" border="1" cellpadding="3" width="100%" >
<apex:column >
<apex:facet name="header">Item Number</apex:facet>
<apex:outputText value="{!item.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Description</apex:facet>
<apex:outputText value="{!item.Description__c}"/>
</apex:column>
 </apex:datatable>
<hr></hr>
   <b>RECIEVED ITEMS</b>
<hr></hr>
 <apex:dataTable value="{!cvReceivedItemLineItemsSorted}" var="item" border="1" cellpadding="3" width="100%" >
<apex:column >
<apex:facet name="header">Item Number</apex:facet>
<apex:outputText value="{!item.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Description</apex:facet>
<apex:outputText value="{!item.Description__c}"/>
</apex:column>
 </apex:datatable>
  <hr></hr>
</apex:page>


APEX CLASS
public with sharing class ProjectSummaryPDFController {
       //set up the class variables we'll need to reference from VF page
       public List<Sent_item__c> cvSentItemLineItemsSorted {public get; private set;}
       public List<Received_item__c> cvReceivedItemLineItemsSorted {public get; private set;}
       
       //variable to hold current Project__c record
       private Project__c cvSelectedProject = null;
       
       //constructor
       public ProjectSummaryPDFController(ApexPages.StandardController pCntrllr)
       {
               // grab current Project__c record from the Standard Controller
               cvSelectedProject = (Project__c)pCntrllr.getRecord(); 
                       
               // build sorted List of Sent_item__c records for current Project__c
               cvSentItemLineItemsSorted = new List<Sent_item__c>();
               cvSentitemLineItemsSorted = 
                       [Select item.Name,
                               item.Description__c
                        From Sent_item__c item
                        Where item.Project_Number__c =: cvSelectedProject.id
                        ORDER BY item.Name ASC
                        limit 1000];
               
               // build sorted List of Received_item__c records for current Project__c
               cvReceivedItemLineItemsSorted = new List<Received_item__c>();
               cvReceivedItemLineItemsSorted = 
                       [Select item.Name, 
                               item.Description__c
                        From Received_item__c item
                        Where item.Project_Number__c =: cvSelectedProject.id
                        ORDER BY item.Name ASC
                        limit 1000];                         
       }     
}


APEX TEST CLASS
@isTest
private class testProjectSummaryPDFController {

   static testMethod void myUnitTest() {
        
       // make a valid Project__c record we will sent to PDF controller
       Project__c lvProject = makeValidProject();
       
       // make a Sent_item__c record for the project
       Sent_item__c lvSentItemObj = makeSentItemObj(lvProject);
       
       // make a Received_item__c record for the project
       Received_item__c lvReceivedItemObj = makeReceivedItemObj(lvProject);
       
       // first get the standard controller for my object and pass in the Project obj
       ApexPages.StandardController lvStdCntrllr = new ApexPages.standardController(lvProject);

       // now create an instance of my controller
       ProjectSummaryPDFController controller = new ProjectSummaryPDFController(lvStdCntrllr);

   }
       
static private Project__c makeValidProject() {
       // create Test Project record 
       Project__c lvProj = new Project__c();
       lvProj.Name = 'Name';
   lvProj.Project_name__c = 'Project Name';
       lvProj.Contractor__c = 'Contractor';
       
       insert lvProj; 
       
       return lvProj;
   }
   
   static private Sent_item__c makeSentItemObj(Project__c pProj) {
       Sent_Item__c lvObj = new Sent_Item__c();
       lvObj.Name = 'Name';
       lvObj.Description__c = 'Description';
       lvObj.Project_Number__c = pProj.Id;
       
       insert lvObj; 
       
       return lvObj;
   }
   
   static private Received_item__c makeReceivedItemObj(Project__c pProj) {
       Received_item__c lvObj = new Received_item__c();
       lvObj.Name = 'Name';
       lvObj.Description__c = 'Description';
       lvObj.Project_Number__c = pProj.Id;
       
       insert lvObj; 
       
       return lvObj;

   }
}

 

I am creating a simple app that will manage Sent and Received documents for Projects.

I have set up the master custom object called Project and have two detail custom objects related to the master object called Sent and Received.

The Sent and Received are sorted by default in Force.com but not in the visualforce PDF page.

Based on the attached code from my VF page, i need a price by to provide the exact coding needed to allow sorting by default (name) for my two dateTables.

I need the exact coding for this VF page and any necessary components or controllers.

 

I work in South San Francisco and live in the Walnut Creek Area. I can travel to the San Jose area if needed. I also frequently use webex and can set up a meeting and share my desktop to verify whether or not the code works. I am available from 7am to 10pm any day.

Thank you in advance. Reply by email through econtractorpro@gmail.com

Sean.

 

 

<apex:page standardController="Project__c" sidebar="false" showHeader="false" renderAs="pdf" standardStylesheets="false">
  <apex:stylesheet value="{!$Resource.customCSS}" />
    
 <hr></hr>
    <h2>PROJECT SUMMARY</h2>
 <hr></hr>
  <p>INFORMATION</p>
<hr></hr>
  
 <table  style="width: 100%;">
 <tr><td style="width: 25%;">Project Name:</td><td style="width: 75%;">{!Project__c.Project_Name__c}</td></tr>
   </table>
   <table  style="width: 100%;">
  <tr><td style="width:25%;">Project Owner:</td><td style="width: 40%;">{!Project__c.Project_Owner__c}</td>
  <td style="width: 20%;">Owner Project No.:</td><td style="width: 15%;">{!Project__c.Owner_Project_No__c}</td>
  </tr>
  </table>
  <table  style="width: 100%;">
 <tr>
 <td style="width: 25%;">Contractor:</td><td style="width: 40%;">{!Project__c.contractor__c}</td>
 <td style="width: 20%;">Contractor Project No.:</td><td style="width: 15%;">{!Project__c.name}</td>
 </tr>
 </table>
   <hr></hr>
 <p>SENT</p>
   <hr></hr>
    <apex:dataTable value="{!Project__c.Sent__r}" var="item" border="1" cellpadding="1" width="100%" style="text-align:center">
<apex:column >
 <apex:facet name="header">Transmittal No.</apex:facet>
<apex:outputText value="{!item.Name}"/>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Revision No.</apex:facet>
<apex:outputText value="{!item.Revision_No__c}"/>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Date</apex:facet>
 <apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
    <apex:param value="{!item.Date__c}" /> 
    </apex:outputText>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Title</apex:facet>
<apex:outputText value="{!item.Title__c}"/>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Information</apex:facet>
<apex:outputText value="{!item.Information__c}"/>
 </apex:column>
</apex:dataTable>
    <hr></hr>
 <p>RECEIVED</p>
  <hr></hr>
  <apex:dataTable value="{!Project__c.Received__r}" var="item" border="1" cellpadding="1" width="100%" style="text-align:center">
<apex:column >
 <apex:facet name="header">Transmittal No.</apex:facet>
<apex:outputText value="{!item.Name}"/>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Revision No.</apex:facet>
<apex:outputText value="{!item.Revision_No__c}"/>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Date</apex:facet>
 <apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
    <apex:param value="{!item.Date__c}" /> 
    </apex:outputText>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Title</apex:facet>
<apex:outputText value="{!item.Title__c}"/>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Information</apex:facet>
<apex:outputText value="{!item.Information__c}"/>
 </apex:column>
</apex:dataTable>
    <hr></hr>
</apex:page>

 

 

SUMMARY
I have signed up for the Salesforce Partner Program and have created a managed app called ABC Company using my Partner Developer Edition account (dev org).

The app consists of one parent custom object (Project__c) and two child custom objects (Sent_item__c & Received_item__c).

I have a visualforce PDF page that displays the Project Summary with the Sent and Received related lists. For this VF PDF Page I have created an Apex Class that sorts/orders the list by Name ASC for Sent and Received Related Lists. I also have an apex test class with 100% code coverage.

The Generate Visualforce PDF Page works without any problems in my Partner Developer Edition account (dev org).

PROBLEM
After successful installation of my app on my Enterprise/Platform Edition account (Test Org) as a managed app I receive the following error when I try to generate the VF page:

common.apex.runtime.impl.ExecutionException: SObject row was retrieved via SOQL without querying the requested field:ecpfinal__Project__c.Name

(The error only occurs in my managed solution when installed on another Enterprise/Platform Edition account (Test Org))

Can you provide the necessary code to fix this error? Do I need to add additional code to the apex class?

VISUALFORCE PDF PAGE (Project_Summary)
<apex:page standardController="Project__c" sidebar="false" showHeader="false" renderAs="pdf" extensions="ProjectSummaryPDFController">
<hr></hr>
   <h3>PROJECT SUMMARY</h3>
<hr></hr>
 <table  style="width: 100%;">
<tr><td style="width: 25%;">Project Number:</td><td style="width: 75%;">{!Project__c.Name}</td></tr>
<tr><td style="width: 25%;">Project Name:</td><td style="width: 75%;">{!Project__c.Project_Name__c}</td></tr>
<tr><td style="width: 25%;">Contractor:</td><td style="width: 75%;">{!Project__c.Contractor__c}</td></tr>
 </table>
 <hr></hr>
   <b>SENT ITEMS</b>
<hr></hr>
<apex:dataTable value="{!cvSentItemLineItemsSorted}" var="item" border="1" cellpadding="3" width="100%" >
<apex:column >
<apex:facet name="header">Item Number</apex:facet>
<apex:outputText value="{!item.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Description</apex:facet>
<apex:outputText value="{!item.Description__c}"/>
</apex:column>
 </apex:datatable>
<hr></hr>
   <b>RECIEVED ITEMS</b>
<hr></hr>
 <apex:dataTable value="{!cvReceivedItemLineItemsSorted}" var="item" border="1" cellpadding="3" width="100%" >
<apex:column >
<apex:facet name="header">Item Number</apex:facet>
<apex:outputText value="{!item.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Description</apex:facet>
<apex:outputText value="{!item.Description__c}"/>
</apex:column>
 </apex:datatable>
  <hr></hr>
</apex:page>


APEX CLASS
public with sharing class ProjectSummaryPDFController {
       //set up the class variables we'll need to reference from VF page
       public List<Sent_item__c> cvSentItemLineItemsSorted {public get; private set;}
       public List<Received_item__c> cvReceivedItemLineItemsSorted {public get; private set;}
       
       //variable to hold current Project__c record
       private Project__c cvSelectedProject = null;
       
       //constructor
       public ProjectSummaryPDFController(ApexPages.StandardController pCntrllr)
       {
               // grab current Project__c record from the Standard Controller
               cvSelectedProject = (Project__c)pCntrllr.getRecord(); 
                       
               // build sorted List of Sent_item__c records for current Project__c
               cvSentItemLineItemsSorted = new List<Sent_item__c>();
               cvSentitemLineItemsSorted = 
                       [Select item.Name,
                               item.Description__c
                        From Sent_item__c item
                        Where item.Project_Number__c =: cvSelectedProject.id
                        ORDER BY item.Name ASC
                        limit 1000];
               
               // build sorted List of Received_item__c records for current Project__c
               cvReceivedItemLineItemsSorted = new List<Received_item__c>();
               cvReceivedItemLineItemsSorted = 
                       [Select item.Name, 
                               item.Description__c
                        From Received_item__c item
                        Where item.Project_Number__c =: cvSelectedProject.id
                        ORDER BY item.Name ASC
                        limit 1000];                         
       }     
}


APEX TEST CLASS
@isTest
private class testProjectSummaryPDFController {

   static testMethod void myUnitTest() {
        
       // make a valid Project__c record we will sent to PDF controller
       Project__c lvProject = makeValidProject();
       
       // make a Sent_item__c record for the project
       Sent_item__c lvSentItemObj = makeSentItemObj(lvProject);
       
       // make a Received_item__c record for the project
       Received_item__c lvReceivedItemObj = makeReceivedItemObj(lvProject);
       
       // first get the standard controller for my object and pass in the Project obj
       ApexPages.StandardController lvStdCntrllr = new ApexPages.standardController(lvProject);

       // now create an instance of my controller
       ProjectSummaryPDFController controller = new ProjectSummaryPDFController(lvStdCntrllr);

   }
       
static private Project__c makeValidProject() {
       // create Test Project record 
       Project__c lvProj = new Project__c();
       lvProj.Name = 'Name';
   lvProj.Project_name__c = 'Project Name';
       lvProj.Contractor__c = 'Contractor';
       
       insert lvProj; 
       
       return lvProj;
   }
   
   static private Sent_item__c makeSentItemObj(Project__c pProj) {
       Sent_Item__c lvObj = new Sent_Item__c();
       lvObj.Name = 'Name';
       lvObj.Description__c = 'Description';
       lvObj.Project_Number__c = pProj.Id;
       
       insert lvObj; 
       
       return lvObj;
   }
   
   static private Received_item__c makeReceivedItemObj(Project__c pProj) {
       Received_item__c lvObj = new Received_item__c();
       lvObj.Name = 'Name';
       lvObj.Description__c = 'Description';
       lvObj.Project_Number__c = pProj.Id;
       
       insert lvObj; 
       
       return lvObj;

   }
}

 

 

SUMMARY
I have signed up for the Salesforce Partner Program and have created a managed app called ABC Company using my Partner Developer Edition account (dev org).

The app consists of one parent custom object (Project__c) and two child custom objects (Sent_item__c & Received_item__c).

I have a visualforce PDF page that displays the Project Summary with the Sent and Received related lists. For this VF PDF Page I have created an Apex Class that sorts/orders the list by Name ASC for Sent and Received Related Lists. I also have an apex test class with 100% code coverage.

The Generate Visualforce PDF Page works without any problems in my Partner Developer Edition account (dev org).

PROBLEM
After successful installation of my app on my Enterprise/Platform Edition account (Test Org) as a managed app I receive the following error when I try to generate the VF page:

common.apex.runtime.impl.ExecutionException: SObject row was retrieved via SOQL without querying the requested field:ecpfinal__Project__c.Name

(The error only occurs in my managed solution when installed on another Enterprise/Platform Edition account (Test Org))

Can you provide the necessary code to fix this error? Do I need to add additional code to the apex class?

I am available through Skype and would like to drop in the code in real time through Skype with screen share or another similar method..

 

 

VISUALFORCE PDF PAGE (Project_Summary)
<apex:page standardController="Project__c" sidebar="false" showHeader="false" renderAs="pdf" extensions="ProjectSummaryPDFController">
<hr></hr>
   <h3>PROJECT SUMMARY</h3>
<hr></hr>
 <table  style="width: 100%;">
<tr><td style="width: 25%;">Project Number:</td><td style="width: 75%;">{!Project__c.Name}</td></tr>
<tr><td style="width: 25%;">Project Name:</td><td style="width: 75%;">{!Project__c.Project_Name__c}</td></tr>
<tr><td style="width: 25%;">Contractor:</td><td style="width: 75%;">{!Project__c.Contractor__c}</td></tr>
 </table>
 <hr></hr>
   <b>SENT ITEMS</b>
<hr></hr>
<apex:dataTable value="{!cvSentItemLineItemsSorted}" var="item" border="1" cellpadding="3" width="100%" >
<apex:column >
<apex:facet name="header">Item Number</apex:facet>
<apex:outputText value="{!item.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Description</apex:facet>
<apex:outputText value="{!item.Description__c}"/>
</apex:column>
 </apex:datatable>
<hr></hr>
   <b>RECIEVED ITEMS</b>
<hr></hr>
 <apex:dataTable value="{!cvReceivedItemLineItemsSorted}" var="item" border="1" cellpadding="3" width="100%" >
<apex:column >
<apex:facet name="header">Item Number</apex:facet>
<apex:outputText value="{!item.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Description</apex:facet>
<apex:outputText value="{!item.Description__c}"/>
</apex:column>
 </apex:datatable>
  <hr></hr>
</apex:page>


APEX CLASS
public with sharing class ProjectSummaryPDFController {
       //set up the class variables we'll need to reference from VF page
       public List<Sent_item__c> cvSentItemLineItemsSorted {public get; private set;}
       public List<Received_item__c> cvReceivedItemLineItemsSorted {public get; private set;}
       
       //variable to hold current Project__c record
       private Project__c cvSelectedProject = null;
       
       //constructor
       public ProjectSummaryPDFController(ApexPages.StandardController pCntrllr)
       {
               // grab current Project__c record from the Standard Controller
               cvSelectedProject = (Project__c)pCntrllr.getRecord(); 
                       
               // build sorted List of Sent_item__c records for current Project__c
               cvSentItemLineItemsSorted = new List<Sent_item__c>();
               cvSentitemLineItemsSorted = 
                       [Select item.Name,
                               item.Description__c
                        From Sent_item__c item
                        Where item.Project_Number__c =: cvSelectedProject.id
                        ORDER BY item.Name ASC
                        limit 1000];
               
               // build sorted List of Received_item__c records for current Project__c
               cvReceivedItemLineItemsSorted = new List<Received_item__c>();
               cvReceivedItemLineItemsSorted = 
                       [Select item.Name, 
                               item.Description__c
                        From Received_item__c item
                        Where item.Project_Number__c =: cvSelectedProject.id
                        ORDER BY item.Name ASC
                        limit 1000];                         
       }     
}


APEX TEST CLASS
@isTest
private class testProjectSummaryPDFController {

   static testMethod void myUnitTest() {
        
       // make a valid Project__c record we will sent to PDF controller
       Project__c lvProject = makeValidProject();
       
       // make a Sent_item__c record for the project
       Sent_item__c lvSentItemObj = makeSentItemObj(lvProject);
       
       // make a Received_item__c record for the project
       Received_item__c lvReceivedItemObj = makeReceivedItemObj(lvProject);
       
       // first get the standard controller for my object and pass in the Project obj
       ApexPages.StandardController lvStdCntrllr = new ApexPages.standardController(lvProject);

       // now create an instance of my controller
       ProjectSummaryPDFController controller = new ProjectSummaryPDFController(lvStdCntrllr);

   }
       
static private Project__c makeValidProject() {
       // create Test Project record 
       Project__c lvProj = new Project__c();
       lvProj.Name = 'Name';
   lvProj.Project_name__c = 'Project Name';
       lvProj.Contractor__c = 'Contractor';
       
       insert lvProj; 
       
       return lvProj;
   }
   
   static private Sent_item__c makeSentItemObj(Project__c pProj) {
       Sent_Item__c lvObj = new Sent_Item__c();
       lvObj.Name = 'Name';
       lvObj.Description__c = 'Description';
       lvObj.Project_Number__c = pProj.Id;
       
       insert lvObj; 
       
       return lvObj;
   }
   
   static private Received_item__c makeReceivedItemObj(Project__c pProj) {
       Received_item__c lvObj = new Received_item__c();
       lvObj.Name = 'Name';
       lvObj.Description__c = 'Description';
       lvObj.Project_Number__c = pProj.Id;
       
       insert lvObj; 
       
       return lvObj;

   }
}

 

I am creating a simple app that will manage Sent and Received documents for Projects.

I have set up the master custom object called Project and have two detail custom objects related to the master object called Sent and Received.

The Sent and Received are sorted by default in Force.com but not in the visualforce PDF page.

Based on the attached code from my VF page, i need a price by to provide the exact coding needed to allow sorting by default (name) for my two dateTables.

I need the exact coding for this VF page and any necessary components or controllers.

 

I work in South San Francisco and live in the Walnut Creek Area. I can travel to the San Jose area if needed. I also frequently use webex and can set up a meeting and share my desktop to verify whether or not the code works. I am available from 7am to 10pm any day.

Thank you in advance. Reply by email through econtractorpro@gmail.com

Sean.

 

 

<apex:page standardController="Project__c" sidebar="false" showHeader="false" renderAs="pdf" standardStylesheets="false">
  <apex:stylesheet value="{!$Resource.customCSS}" />
    
 <hr></hr>
    <h2>PROJECT SUMMARY</h2>
 <hr></hr>
  <p>INFORMATION</p>
<hr></hr>
  
 <table  style="width: 100%;">
 <tr><td style="width: 25%;">Project Name:</td><td style="width: 75%;">{!Project__c.Project_Name__c}</td></tr>
   </table>
   <table  style="width: 100%;">
  <tr><td style="width:25%;">Project Owner:</td><td style="width: 40%;">{!Project__c.Project_Owner__c}</td>
  <td style="width: 20%;">Owner Project No.:</td><td style="width: 15%;">{!Project__c.Owner_Project_No__c}</td>
  </tr>
  </table>
  <table  style="width: 100%;">
 <tr>
 <td style="width: 25%;">Contractor:</td><td style="width: 40%;">{!Project__c.contractor__c}</td>
 <td style="width: 20%;">Contractor Project No.:</td><td style="width: 15%;">{!Project__c.name}</td>
 </tr>
 </table>
   <hr></hr>
 <p>SENT</p>
   <hr></hr>
    <apex:dataTable value="{!Project__c.Sent__r}" var="item" border="1" cellpadding="1" width="100%" style="text-align:center">
<apex:column >
 <apex:facet name="header">Transmittal No.</apex:facet>
<apex:outputText value="{!item.Name}"/>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Revision No.</apex:facet>
<apex:outputText value="{!item.Revision_No__c}"/>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Date</apex:facet>
 <apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
    <apex:param value="{!item.Date__c}" /> 
    </apex:outputText>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Title</apex:facet>
<apex:outputText value="{!item.Title__c}"/>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Information</apex:facet>
<apex:outputText value="{!item.Information__c}"/>
 </apex:column>
</apex:dataTable>
    <hr></hr>
 <p>RECEIVED</p>
  <hr></hr>
  <apex:dataTable value="{!Project__c.Received__r}" var="item" border="1" cellpadding="1" width="100%" style="text-align:center">
<apex:column >
 <apex:facet name="header">Transmittal No.</apex:facet>
<apex:outputText value="{!item.Name}"/>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Revision No.</apex:facet>
<apex:outputText value="{!item.Revision_No__c}"/>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Date</apex:facet>
 <apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
    <apex:param value="{!item.Date__c}" /> 
    </apex:outputText>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Title</apex:facet>
<apex:outputText value="{!item.Title__c}"/>
 </apex:column>
 <apex:column >
 <apex:facet name="header">Information</apex:facet>
<apex:outputText value="{!item.Information__c}"/>
 </apex:column>
</apex:dataTable>
    <hr></hr>
</apex:page>