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
puli rajupuli raju 

create a pageblocktable that reads ids from the url and display records for editing

Srinivas SSrinivas S
Hi Raju,

Please see the following solution which is tested and working, please mark it as a solution if it is working out for you.

Apex Class:
public class VfContrl {
    List<Id> recordIds;
    public List<Account> accounts {get;set;}
    public VfContrl() {
        recordIds = new List<Id>();
        recordIds.addAll((List<Id>)Apexpages.currentPage().getParameters().values());
        //Assuming the object as Account
        accounts = new List<Account>();
        accounts = [Select Name, Industry from Account where id in: recordIds];
    }
    public void save() {
        upsert accounts;
    }
}

------
Visualforce Page:
<apex:page controller="VfContrl">
    <apex:form>
        <apex:pageBlock title="Accounts">
            <apex:pageBlockTable value="{!accounts}" var="acc">
                <apex:column headerValue="Name">
                    <apex:inputField value="{!acc.Name}"/>
                </apex:column>
                <apex:column headerValue="Industry">
                    <apex:inputField value="{!acc.Industry}"/>
                </apex:column>
            </apex:pageBlockTable>
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

-----------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
 
Srinivas SSrinivas S
Your URL should be in the following format -
https://c.ap2.visual.force.com/apex/AccountsFrmIdsOfUrl?id1=recordid&id2=recordid
-----------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
mritzimritzi
You need a combination of Apex class and VF page to acheive this

Following is a sample Apex class and VF page which works on Account object

Apex:
public class TestClass2 { 
  public string str{get;set;}
  public Account ac{get;set;}
    
  public TestClass2(){
      Id acId = ApexPages.currentPage().getParameters().get('id');
      if(acId!=null){
          try{
              // you can retrieve variables depending on your requirement
              ac = [Select id,Name,Phone,Website From Account Where id=:acId Limit 1];
          }catch(Exception e){
              str = e.getMessage();
          }
      }
      else
          str = 'Invalid/Null Id';
  }
  public void updateAccount(){
      if(ac.id!=null)
          update ac;
  }
}

VF:
<apex:page controller="TestClass2" >
    <apex:form >
        <!-- following section will show up only if url is invalid or there is some error in SOQL query -->
        <apex:pageBlock rendered="{!str!=null}">
            <h2 style="color:red">{!str}</h2>
        </apex:pageBlock>
<!-- following section will show up only if a record is successfully retreived from database -->
        <apex:pageBlock rendered="{!ac.id!=null}">
            <apex:dataTable value="{!ac}" var="a">
              <apex:column headerValue="Name">
                  <apex:inputtext value="{!a.Name}"/>
              </apex:column>
              <apex:column headerValue="Phone">
                  <apex:inputtext value="{!a.Phone}"/>
              </apex:column>
              <apex:column headerValue="Website">
                  <apex:inputtext value="{!a.Website}"/>
              </apex:column>
              <apex:column headerValue="Update">
                  <apex:commandButton action="{!updateAccount}" value="Update"/>
              </apex:column>
          </apex:dataTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

The URL should end with   ->   "?id=<Id of the record which has to be edited>"
Use it as a template to meet your requirements.

mark this as Best Answer, if it solves your problem.