Mass updating records with a custom list controller Free my live video cams4

Posted by / 13-Dec-2014 02:26

By using standard standard list controllers we can manage set of records.

For every standard controller there exists a standard list controller that allows you to create pages that display and act on a set of records, such as list pages, related lists, and mass action pages.

I promise this is the last post for a while around list handling!

As the records haven't been added to the database yet, they don't have a unique identifier that I can use to locate them, so the first task is to create a wrapper class that encapsulates an Account and an identifier - I decided on an Integer.

We can associate define standard list controller by using record Set Var.

Standard list controller provides additional four pagination actions. We can use standard list controllers with the following objects.

public class Account Wrapper { public Account acc {get; private set;} public Integer ident {get; private set;} public Account Wrapper(Integer in Ident) { ident=in Ident; acc=new Account(Name='Bulk Acc ' + ident); } } Note that the wrapper class provides a useful constructor, that creates the wrapped record and automatically populates the Name of the Account based on the unique identifier.

As I'm only concerned with the uniqueness of the Account Wrapper within the context of my page, generating a unique identifier is as simple as defining a property in my controller: The unique identifier is passed to the controller via the apex:param component.If this is the first time that you've encountered this component, you may be interested in another blog post of mine explaining its use in detail Note that I'm using the apex:param technique for both the Add Row and Add 5 Rows buttons - this means I can have additional buttons for any number of rows without having to change the Apex code.Account, Asset, Campaign, Case, Contact, Contract, Idea, Lead, Opportunity, Order, Product2, Solution, User, Custom Objects.This week's post concerns bulk creation of an unknown number of sobject records - Accounts, for example.In this situation I want to display a table containing a set number of new records (5 in this case), enter the various pieces of information and save to the database en-masse.

mass updating records with a custom list controller-34mass updating records with a custom list controller-83mass updating records with a custom list controller-55

However, I also want to be able to add or remove rows prior to saving anything, so that if I need to I can enter 1, 3, 10 etc at once.

One thought on “mass updating records with a custom list controller”

  1. According to this New York Times article, many millennials “hang out” versus go on traditional dates. That’s right, now you find yourself with this person a LOT, like 24/7.