• Synclair
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi,  
I have a visualforce page for a custom object. It uses standard controller and an extension.  I want to take users to the object listview after saving the record or cancelling.  Here is my Visualforce and Apex coce.  After I click save nothing happens.   Thanks for your help!

Visualforce:
<apex:page standardController="Self_Matrix__c" extensions="e1">
  <apex:form >
    <apex:pageBlock title="">
    
          <apex:pageblockButtons >
              <apex:commandbutton action="{!save}" value="Save"/>
          </apex:pageblockButtons>
              <apex:pageblockButtons >
              <apex:commandbutton action="{!cancel}" value="cancel"/>
          </apex:pageblockButtons>
                
          <apex:pageblockSection >
              <apex:inputfield value="{!Self_Matrix__c.name}"/>
              <apex:inputfield value="{!Self_Matrix__c.Date__c}"/>
              <apex:inputfield value="{!Self_Matrix__c.student_ID__c}"/>
              <apex:inputfield value="{!Self_Matrix__c.Type__c}"/>        
          </apex:pageblockSection>
          <apex:pageBlockSection title="Housing" columns="1">
             <apex:pageblockTable value="{!Self_Matrix__c}" var="act" >
              <apex:column headerValue="1" headerClass="headingCenter" > 
                 <apex:outputLabel > Subject.</apex:outputLabel>
              </apex:column>
              <apex:column headerValue="3" headerClass="headingCenter">
                 <apex:outputLabel > Interest.</apex:outputLabel>
              </apex:column>
              <apex:column headerValue="Student Goal" headerClass="headingCenter"> 
                 <apex:outputLabel value=""> </apex:outputLabel>
                 <apex:inputCheckbox value="{!act.Student_Goal__c}" style="float:center"/>
              </apex:column>
         </apex:pageblockTable>
       
       </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>
 
Apex:
public class e1 {
    public e1(ApexPages.StandardController controller) {}
public static PageReference listView(Schema.sObjectType destinationSObject) {
   Schema.DescribeSObjectResult destination = Self_Matrix__c.SObjectType.getDescribe();
   PageReference pageRef = new PageReference('/' + destination.getKeyPrefix() + 'a/o' );
   pageRef.setRedirect(true);
   return listView(Self_Matrix__c.sObjectType);
    }
}