+ Start a Discussion
H 007H 007 

Hi Everyone, I am trying to create a Edit button on Order Detail page for Related records in my VF page, but the following error is appears. Unknown method 'OrderStandardController.recEdit()'. Can Anyone please me..

Order Detail Page:
<apex:page standardController="Order" action="{!details}" extensions="OrderClass" lightningStylesheets="true">
    
  <apex:form >
     <script>
        function fun(){
            EditProject();
      }
    </script>
    <apex:pageBlock rendered="{!ShowpageDetailPage}">
            <apex:pageBlockSection title="Order Record Information" columns="2" >
                <apex:outputField value="{!Order.Name}"/>
                <apex:outputField value="{!Order.OrderNumber}"/>
                <apex:outputField value="{!Order.AccountId}"/>
                <apex:outputField value="{!Order.OpportunityId}"/>
                <apex:outputField value="{!Order.Type}"/>
                <apex:outputField value="{!Order.CurrencyIsoCode}"/>
                <apex:outputField value="{!Order.CompanyAuthorizedById}"/>
                <apex:outputField value="{!Order.CustomerAuthorizedDate}"/>
                <apex:outputField value="{!Order.ShipToContactId}"/>
                <apex:outputField value="{!Order.Project_Start_Date__c}"/>
                <apex:outputField value="{!Order.Project_End_Date__c}"/>
                <apex:outputField value="{!Order.Activated__c}"/>
                <apex:outputField value="{!Order.Invoice_Date__c}"/>
                <apex:outputField value="{!Order.TotalAmount}"/>
                <apex:outputField value="{!Order.Close_Date__c}"/>
                <apex:outputField value="{!Order.Description}"/>                  
            </apex:pageBlockSection>  
        <apex:pageBlockButtons >
                <apex:commandButton value="Edit"  action="{!ShowBlockMethod}"/>
            </apex:pageBlockButtons>                  
    </apex:pageBlock>
  </apex:form> 
    
    <apex:form >
    <apex:pageBlock rendered="{!ShowpageEditPage}">
            <apex:pageBlockSection title="Order Record Information" columns="2" >
                <apex:inputField value="{!Order.Name}"/>
                <apex:inputField value="{!Order.OrderNumber}"/>
                <apex:inputField value="{!Order.AccountId}"/>
                <apex:inputField value="{!Order.OpportunityId}"/>
                <apex:inputField value="{!Order.Type}"/>
                <apex:inputField value="{!Order.CurrencyIsoCode}"/>
                <apex:inputField value="{!Order.CompanyAuthorizedById}"/>
                <apex:inputField value="{!Order.CustomerAuthorizedDate}"/>
                <apex:inputField value="{!Order.ShipToContactId}"/>
                <apex:inputField value="{!Order.Project_Start_Date__c}"/>
                <apex:inputField value="{!Order.Project_End_Date__c}"/>
                <apex:inputField value="{!Order.Activated__c}"/>
                <apex:inputField value="{!Order.Invoice_Date__c}"/>
                <apex:inputField value="{!Order.TotalAmount}"/>
                <apex:inputField value="{!Order.Close_Date__c}"/>
                <apex:inputField value="{!Order.Description}"/>                  
            </apex:pageBlockSection>  
        <apex:pageBlockButtons >
                <apex:commandButton value="Save"  action="{!Save}"/>
            </apex:pageBlockButtons>                  
    </apex:pageBlock>
  </apex:form> 
     <apex:form >
    <apex:pageBlock >  
        <apex:actionFunction action="{!recEdit}" Name="EditProject" immediate="true"></apex:actionFunction>
        <apex:pageBlockTable title="Releted Record" value="{!releted}" var="r"> 
              <apex:column >
                <apex:outputLink value="/apex/ProjectDetailPage?id={!r.id}">Del | </apex:outputLink>            
                <apex:outputLink onclick="fun();" value="/apex/ProjectDetailPage?id={!r.id}" >Edit | </apex:outputLink>     
             </apex:column> 
            <apex:column >
                 <apex:outputLink value="/apex/ProjectDetailPage?id={!r.id}"> {!r.name}</apex:outputLink>
             </apex:column> 
             <apex:column value="{!r.Start__c}"/>
            <apex:column value="{!r.End__c}"/>
            <apex:column value="{!r.Status__c}"/>
            <apex:column value="{!r.Project_Amount__c}"/>
            <apex:column value="{!r.Total_Cost__c}"/>            
        </apex:pageBlockTable>               
    </apex:pageBlock>
       </apex:form>     
</apex:page>
Related Object VF page
<apex:page controller="ProjectClass" action="{!getProject}" lightningStylesheets="true">
  <apex:form >  
       <apex:pageBlock rendered="true" >              
            <apex:pageBlockSection title=" Project Information" columns="2" >                
                <apex:outputField value="{!pr.Name}"/>
                <apex:outputField value="{!pr.Order__c}"/>
                <apex:outputField value="{!pr.Start__c}"/>
                <apex:outputField value="{!pr.End__c}"/>
                <apex:outputField value="{!pr.Status__c}"/>
                <apex:outputField value="{!pr.Project_Amount__c}"/>
                <apex:outputField value="{!pr.Total_Cost__c}"/>             
            </apex:pageBlockSection>
       </apex:pageBlock>
  </apex:form>     
      <apex:form >  
    <apex:pageBlock rendered="isEditable">           
            <apex:pageBlockSection title=" Project Information" columns="2" >                
                <apex:inputField value="{!pr.Name}"/>
                <apex:inputField value="{!pr.Order__c}"/>
                <apex:inputField value="{!pr.Start__c}"/>
                <apex:inputField value="{!pr.End__c}"/>
                <apex:inputField value="{!pr.Status__c}"/>
                <apex:inputField value="{!pr.Project_Amount__c}"/>
                <apex:inputField value="{!pr.Total_Cost__c}"/>             
            </apex:pageBlockSection>
         <apex:pageBlockButtons >
                <apex:commandButton value="Save"  action="{!Save}"/>
            </apex:pageBlockButtons>
    </apex:pageBlock> 
  </apex:form>
   </apex:page>
public with sharing class OrderClass {
   public Order orderRecord { get; set; }
    public Boolean ShowpageEditPage {get; set;}
    public Boolean ShowpageDetailPage {get; set;}
    Public List<Cus_Project__c> releted{get;set;}
    public OrderClass (ApexPages.StandardController controller) {
        ShowpageEditPage=false;
        ShowpageDetailPage=true;    
     }     
      Public void ShowBlockMethod(){
       ShowpageEditPage =true;
      ShowpageDetailPage= false;
    }        
        Public void details(){                      // Use for Show Releted  Record  on Detailpage       
       
        releted=[Select Id, name, Order__c,Start__c, End__c,Project_Amount__c, Total_Cost__c,Status__c
                 from Cus_Project__c where Order__c =:ApexPages.currentPage().getParameters().get('id')];
    } 
}
public with sharing class ProjectClass {
    
     public List<Cus_Project__c> proj{get;set;}//show Order Data 
        Public Cus_Project__c pr{get;set;}
     Public Boolean isEditable {get;set;}
    
     Public ProjectClass(){
         isEditable= false;
     }   
    
     Public void getProject(){
        pr=[Select Id, name,Order__c,Start__c, End__c,Project_Amount__c, Total_Cost__c,Status__c
                 from Cus_Project__c where id =:ApexPages.currentPage().getParameters().get('id')];       
    }
     public PageReference Save(){
            update pr;
            PageReference pnext = new PageReference('/apex/ProjectDetailPage?id='+pr.id);
            pnext.setRedirect(true);
            return pnext;
    }    
    Public void recEdit(){
        isEditable= true;
    }
}
Geoffrey HillsGeoffrey Hills
Fulfilled to consider your to be as I would survey I have an unclear issue, I am likewise confused and requiring light on this not well characterized issue. Need help.
https://www.myehtrip.me/