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
K.G.K.G. 

How Do I Pass A "Record Being Interacted With" From VisualForce PageBlockTable To A Controller Method?

Hi Developers,
I am writing a VisualForce page that displays a pageBlockTable full of "wrapper-class"-wrapped CampaignMember records (and their associated details). It is for quick marking of whether people came or not at the event itself.

I'd like to have a column at the far right of my table with a "Set Status To Attended" button (or link) that does an IMMEDIATE update (including DML ... I might scale that back if performance is an issue, but right now the request is "live edits") of the "Status" of the CampaignMember record represented by the row the button appears in.

The reason I don't just want to expose "Status" as an "inlineEdit" or "inputField" is that SalesForce natively exposes more possibilities than are appropriate for the Campaign attached to that CampaignMember. Plus, users would like the single button better.

Even though my wrapped CampaignMember record is already identified as 'var="cm"' to the pageBlockTable, I can't figure out how to pass that back to a method in my controller as part of what the button/link does when clicked.

How should I get the "record whose button is being clicked" back to a method in the controller so that I can have the method do its magic? Apex Params don't seem to do what I thought they would (pass a parameter to a public Java method).

Thank you!