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
BridgetreeBridgetree 

Update Editted Records

I have set of records that is Selected from a Custom object for a particular Account.

These records are put in pageBlockTable. Now i am editing the records.

I have put a save button. On clicking the records should be updated..

 

Can anyone help me out...

 

public List<BC_Products__c> getAccount() { 

 

      List<BC_Products__c> products= [select Name,Product_Description__c,Status__c

                                where AccountName__c = :ApexPages.currentPage().getParameters().get('id')];                   

      return products;   

 

}

 

public PageReference save()

{

What code has to be here????

}

Shashikant SharmaShashikant Sharma

You will be updating one record or all from the table, could you please share you VFP code as well ?

SFDC_LearnerSFDC_Learner

Follow these steps:

It need two pages. One for querying data into pageblock table. Second for Editing the record.

In First Page:

1. Using <apex:param> tag pass the Record  Id (when we click on Edit link) to the controller. and Query the selected record using SOQL query. Here you need to create pagereference and pass Id from that pagereference to the next page.

It is like,

In Page:

 <apex:param name="xId" value="{!x.Id}" assignTo="{!xId}"/>

After Querying in controller:

pagereference ref=new pagereference('/apex/editing?Id='+xid);

 

In Second Page:

1. use Standard Controller and Extensions.

2. In VF page use <apex:inputfield> tag to place the field. Here we also passed id to this page. So That selected value will be displayed in our VF component. Write Save functionality and edit the record. 

3. In Pagereference of "Save" just navigate second page to first page.

 

 

Hope this must helpful.

 

Otherwise, Let me know your problem.