function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

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 -->
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
 <apex:inputText value="{!TestEditSpecimenID }"/>


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');
             TestEditSpecimenID = var;
             Pagereference newpage = new Pagereference ('/apex/CasePopulate');
              //Pagereference newpage =Page.Accession;
            return newpage;
             //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



<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>


 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.