+ Start a Discussion
TechnosTechnos 

Get the ID of Particular record on click of edit from List View page

Hi All,

 

I am opening one VF page on click of edit fo lis view of particular object. Now I want to get the id of that particular record which I edited. I am writing this code but its throwing this error.

 

Cyclical server-side forwards detected: /apex/CasePopulate

 

VF Code

<apex:page standardController="Case_Accession__c" extensions="ExtentionController1" action="{!pageredir}"  >
    <apex:form >
    <apex:pageBlock >
     <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
 <apex:inputText value="{!TestEditSpecimenID }"/>
    </apex:pageBlock>
      </apex:form>
 </apex:page>

 

Apex Code

 

public class ExtentionController1
 {
         public String var {get;set;}
         public string TestEditSpecimenID {get;set;}
     public ExtentionController1(ApexPages.StandardController controller)
     {}
     public Pagereference pageredir()
     {
      var= ApexPages.currentPage().getParameters().get('Id');
           if(var!=null)
           {
             TestEditSpecimenID = var;
             Pagereference newpage = new Pagereference ('/apex/CasePopulate');
              //Pagereference newpage =Page.Accession;
            return newpage;
           }
            else
           {
             //Pagereference newpage =Page.Accession;
             return null;
           }
     }
 }

 

 

One more thing please I want to show the ID of reord into " <apex:inputText value="{!TestEditSpecimenID }"/> "

 

Thanks in advance
Raman

 

 

deepabalisfdcdeepabalisfdc
<apex:page standardController="Test__c" extensions="TestEditClass">
 <apex:form >
 
<apex:inputfield value="{!Test__c.Name}"/> <apex:outputfield value="{!Test__c.Id}"/> ----------------------> Id display <apex:commandbutton value="Update" action="{!update}"/></apex:form></apex:page>

 

 COntroller:
 public class TestEditClass{

public State__c objtest{get;set;} public TestEditClass(ApexPages.StandardController controller) { objtest = new Test__c(); } public pagereference update(){ update objTest; return (new pagereference('/'+objTest.Id).setredirect(true)); }
}
Override Edit button with above VF page. Give necessary input fields.
 
 
Implement the above steps,  then override the standard edit button with this visual force page. It works for you.