+ Start a Discussion

Update selected values into standard object

How do we update the values selected from a checkbox in a visualforce page onto a standard object?

I want to display a list of active users in salesforce and on checkbox click deactivate the corresponding user accounts.


You will want to create a wrapper class in your VF controller to bind a boolean variable to each User object. then output the boolean (as a checkbox) and user object together on your page. When you click an action button on the page, go through the list of wrappers and if the boolean is true (ie, the checkbox is selected), add them to a list of usersToUpdate with isActive = false, then run an update on that userToUpdate list after your loop.


Here's a blog post to help you with the wrapper: