title: Salesforce apex controller extension for custom object and visualforce page
body: <p>I have 2 custom objects i have created and due to the limitations of salesforce lists and reports i cant get more then 255 characters to be displayed on a long textarea.</p>
  
  <pre><code>Sales_Trip__c
  - Name - string
  - Date_From - date
  - Date_To - date
  - Salesman - lookup User
  
  
  Sales_Trip_Visit__c
  - Sales_Trip - master-detail
  - Account - master-detail
  - Notes - Long Textarea
  - Date - date
  </code></pre>
  
  <p>so i'm trying to create a new visualforce page that displays the sales_trip_visit__c's in a table ordered by Sales_Trip_Visit__c.Date</p>
  
  <p>I have the page working using the Sales_Trip__c standard controller
  But that returns the visits unordered.</p>
  
  <p>From what i can tell i cant do that within the page so i am attempting to create an extension for the Sales_Trip__c standard controller that has a method that returns a list of visits ordered by the date.</p>
  
  <p>This is what i have so far and i think i'm not doing something right.</p>
  
  <pre><code>public class mySalesTripControllerExtension {
  
  private final Sales_Trip__c satr;
  
  public mySalesTripControllerExtension(ApexPages.StandardController stdController) {
      this.satr = (Sales_Trip__c)stdController.getRecord();
  }
  
  public List&lt;Sales_Trip_Visits__c&gt; getVisitList() {
      con = new List&lt;Sales_Trip_Visits__c&gt;();
      con = [SELECT Date, Account.Name, Notes FROM Sales_Trip_Visits__c WHERE Sales_Trip__c.id = :this.satr.id ORDER BY Date]
      return con;
  }
  }
  </code></pre>
  
  <p>I'm getting the following error but i think I am doing it completely wrong.</p>
  
  <pre><code>    Error: Compile Error: sObject type 'Sales_Trip_Visits__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 18 column 15
  </code></pre>
  
  <p>Thanks for the help this is now my revised code. and i have kept the nameing convention i am using which is a duplicate custom object same fields / same relationships just a different name ( original had a rich textarea. _2 has a long textarea</p>
  
  <pre><code>public class mySalesTripControllerExtension {
  
      private final Sales_Trip__c satr;
  
      // The extension constructor initializes the private member
      // variable acct by using the getRecord method from the standard
      // controller.
      public mySalesTripControllerExtension(ApexPages.StandardController stdController) {
          this.satr = (Sales_Trip__c)stdController.getRecord();
      }
  
      public List&lt;Sales_Trip_Visit_2__c&gt; getVisitList() {
          Sales_Trip_Visit_2__c con = [SELECT Date__c, Account__r.Name, Notes__c FROM Sales_Trip_Visit_2__c WHERE  Sales_Trip__r.Id = :satr.id ORDER BY Date__c];
          return con;
      }
  }
  </code></pre>
  
  <p>Current error.</p>
  
  <pre><code>Error: Compile Error: Return value must be of type: LIST&lt;Sales_Trip_Visit_2__c&gt; at line 16 column 9 
  </code></pre>