+ Start a Discussion
H 007H 007 

HI, When try to Update the record after clicking on Edit Unable to get the record in Edit mode.. Can someone please help me?

public with sharing class CusOrderData {
    public List<Cus_Order__c> order{get;set;}//show Order Data 
   public Cus_Order__c orderdata{get;set;}
     public Object items{get;set;}
 
    public CusOrderData(){
        orderdata=new Cus_Order__c();
        order=[SELECT Name,Activated__c,Order_Start_Date__c,Order_End_Date__c,Invoice_Date__c,
               Project_Start_Date__c, Project_End_Date__c, Down_payment_amount__c FROM Cus_Order__c];// Show Order Data   
         items = [SELECT Id, name FROM Cus_Order__c where Id=:ApexPages.currentpage().getparameters().get('Id')];
        system.debug(items); 
    }   
   public PageReference Save(){
           upsert order;
               PageReference pnext = new PageReference('/apex/CusOrderData?id='+orderdata.id);
                pnext.setRedirect(true);
            return pnext;
    }
    public void Edit(){                    
    }
}

VF page:
<apex:page controller="CusOrderData" lightningStylesheets="true" tabStyle="Account">
    <apex:form >
        <apex:pageBlock title="Order Edit Page">
               
                <apex:pageBlockSection >                
                <apex:inputField value="{!orderdata.Name}" />
                <apex:inputField value="{!orderdata.Activated__c}" />    
                <apex:inputField value="{!orderdata.Invoice_Date__c}"/>
                <apex:inputField value="{!orderdata.Project_Start_Date__c}"/>
                <apex:inputField value="{!orderdata.Project_End_Date__c}"/>
                <apex:inputField value="{!orderdata.Order_Start_Date__c}"/>
                <apex:inputField value="{!orderdata.Order_End_Date__c}"/>
                <apex:inputField value="{!orderdata.Down_payment_amount__c}"/> 
                    </apex:pageBlockSection>
            
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!Save}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>
VinayVinay (Salesforce Developers) 
What you are trying to do?  do you see any error and kindly check debug logs that should help you to narrow down the scenerio.

Thanks,