+ Start a Discussion
Geoff SpozettaGeoff Spozetta 

Command Button (Edit) Does not display

Hi, I seem to be running into an issue where I do not see an edit button displaying in the following code. which is odd, because all of the recirds display just fine. 
 
<apex:page showHeader="false" standardController="custom_object__c" recordsetvar="orders" >
<apex:include pagename="Header"/>
<apex:include pagename="NavBar"/>
     <div class="container">
	      <div class="row">
        <div class="col-md-12">
	          <h2>My Orders</h2>

    <apex:form >
         <apex:PageBlock rendered="{!IF($User.Id==custom_object__c.CreatedByID || $Profile.Name='System Administrator', true, false)}"  >    
                <apex:pageblockTable value="{!orders}" var="o">
                    <apex:column headervalue="Created By" value="{!o.CreatedBy.Name}"/>
                    <apex:column value="{!o.CreatedDate}"/>
                    <apex:column value="{!o.Name}"/>
                    <apex:column value="{!o.anothercustomfield}"/>
                    <apex:column value="{!o.custom_field}"/>
                    <apex:column value="{!o.custom_field1}"/>
					<apex:column headervalue="Edit"> <apex:commandButton value="Edit" action="{!Edit}" id="edbtn"/> </apex:column>
                </apex:pageblockTable>   
		</apex:Pageblock>
	    </apex:form>
	</div>
	</div>
	</div>



<!-- FOOTER -->
 <apex:include pagename="footer" />   
</apex:page>

 
shephalishephali
Try This
 
<apex:pageBlockButtons >
            <apex:commandButton value="Edit" action="{!Edit}"/>            
        </apex:pageBlockButtons>

 
Deepak GulianDeepak Gulian
<apex:page showHeader="false" standardController="custom_object__c" recordsetvar="orders" >
<apex:include pagename="Header"/>
<apex:include pagename="NavBar"/>
     <div class="container">
	      <div class="row">
        <div class="col-md-12">
	          <h2>My Orders</h2>

    <apex:form >
         <apex:PageBlock rendered="{!IF($User.Id==custom_object__c.CreatedByID || $Profile.Name='System Administrator', true, false)}"  >    
                <apex:pageblockTable value="{!orders}" var="o">
                    <apex:column headervalue="Created By" value="{!o.CreatedBy.Name}"/>
                    <apex:column value="{!o.CreatedDate}"/>
                    <apex:column value="{!o.Name}"/>
                    <apex:column value="{!o.anothercustomfield}"/>
                    <apex:column value="{!o.custom_field}"/>
                    <apex:column value="{!o.custom_field1}"/>
					<apex:column headervalue="Edit"><apex:outputLink value="{!URLFOR($Action.custom_object__c.Edit, o.id,[retURL='/apex/VFPageName'])}">Edit</apex:outputLink>  </apex:column>
                </apex:pageblockTable>   
		</apex:Pageblock>
	    </apex:form>
	</div>
	</div>
	</div>



<!-- FOOTER -->
 <apex:include pagename="footer" />   
</apex:page>
Try this!
Replace VFPageName with your actual page name, to redirect back to VF page after editing the record.
Amit Chaudhary 8Amit Chaudhary 8
Hi Geoff Spozetta,

Just Try output link and remove commandButton.
<apex:outputLink value="/{!o.id}/e" id="theLink">Edit</apex:outputLink>

I tested same in my Developer org
 
<apex:page showHeader="false" standardController="Account" recordsetvar="Accounts" >
    <apex:form >
         <apex:PageBlock rendered="{!IF( $Profile.Name='System Administrator', true, false)}"  >    
                <apex:pageblockTable value="{!Accounts}" var="o">
                    <apex:column headervalue="Created By" value="{!o.CreatedBy.Name}"/>
                    <apex:column value="{!o.CreatedDate}"/>
                    <apex:column value="{!o.name}"/>
                    <apex:column headervalue="Edit"> 
                        <apex:outputLink value="/{!o.id}/e" id="theLink">Edit</apex:outputLink>
                    </apex:column>
                </apex:pageblockTable>   

        </apex:Pageblock>
        </apex:form>
</apex:page>

Your code should be like below
<apex:page showHeader="false" standardController="custom_object__c" recordsetvar="orders" >
<apex:include pagename="Header"/>
<apex:include pagename="NavBar"/>
     <div class="container">
	      <div class="row">
        <div class="col-md-12">
	          <h2>My Orders</h2>

    <apex:form >
         <apex:PageBlock rendered="{!IF($User.Id==custom_object__c.CreatedByID || $Profile.Name='System Administrator', true, false)}"  >    
                <apex:pageblockTable value="{!orders}" var="o">
                    <apex:column headervalue="Created By" value="{!o.CreatedBy.Name}"/>
                    <apex:column value="{!o.CreatedDate}"/>
                    <apex:column value="{!o.Name}"/>
                    <apex:column value="{!o.anothercustomfield}"/>
                    <apex:column value="{!o.custom_field}"/>
                    <apex:column value="{!o.custom_field1}"/>
					<apex:column headervalue="Edit"> 
					
                        <apex:outputLink value="/{!o.id}/e" id="theLink">Edit</apex:outputLink>
						
					</apex:column>
                </apex:pageblockTable>   

		</apex:Pageblock>
	    </apex:form>
	</div>
	</div>
	</div>



<!-- FOOTER -->
 <apex:include pagename="footer" />   
</apex:page>


Please let us know if this will help you