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
bozotheclownbozotheclown 

Update Just One Record in List

Hello. I am running into problems trying to update a single member of a list...and wondered if anyone could point me in the right direction.

 

I am displaying an editable list of results from a search query called "recordsList".  I have inserted a CommandButton command in the VF page so a "save this record change" button is displayed next to each member of this list (I know I could simply place a button at the bottom of the overall list to resave the entire list - but I instead want to provide the ability to save individual records).

 

The below controller code works fine when just one search result is displayed - but it does not save the desired record when "recordsList" displays multiple records.

 

Below is the controller code I am using.  I had hoped that the "[0]" piece of code would allow me to address individual members of the list - but I am obviously wrong.

 

Any suggestions would be greatly appreciated.  Thanks.

 

CONTROLLER CODE

 

Public PageReference SaveThisRecord() {
{
update recordsList[0};
}
return null;
}

ashiiashii

update recordsList[0};

Is it a typo?

 

update recordsList[0];

bozotheclownbozotheclown

Sorry.  That was a typo.  I have re-posted my inquiry to be a bit more specific.