14 votes
Accepted

How to call a standard controller action of a VF page from a VF component

This should be doable by passing an argument of type ApexPages.Action to the component <apex:page standardController="Account"> <apex:form> <apex:pageBlock title="My Content" mode="...
user avatar
  • 63k
13 votes
Accepted

Difference between StandardController and StandardSetController?

ApexPages.StandardController (documentation) encapsulates just a single Sobject (e.g. Account, Opportunity). ApexPages.StandardSetController (documentation) contains a list of records (one or more), ...
user avatar
  • 22.1k
9 votes
Accepted

Any workaround for the bug with StandardSetController getSelected method?

Unfortunately, I don't have an answer for you in terms of a workaround. I did spend some time trying to figure this out because I have a package that makes use of getSelected() on a list view and is ...
user avatar
8 votes

How to call a standard controller action of a VF page from a VF component

You can pass the standard controller to the component, allowing you to invoke its functions normally: public class ComponentControllerClass { public ApexPages.StandardController ...
user avatar
  • 438k
8 votes

Pagination with Wrapper Class and StandardSetController

Using a wrapper class with a set controller is actually pretty simple, but requires a few changes to your code. First, your controller wants to know which records are selected, so you'd start your ...
user avatar
  • 438k
7 votes

System.VisualforceException: Record set cannot be empty

This is a a small curveball, he must just be constructed with concrete list type. Instead of: new ApexPages.StandardSetController(new List<SObject>()); //System.VisualforceException: Record ...
user avatar
7 votes

VF compile error: standardsetController - void.Id

Your issue is you are using quotes in two places for two conflicting use cases As RecordsetVar ​<apex:page controller="QuotePageController" recordSetVar="quotes"> As Getter in controller ...
user avatar
  • 63k
6 votes

Accessing the StandardSetController from a Lightning component

ApexPages.StandardSetController is designed to be run in the context of Visualforce and not Lightning Experience or async contexts (e.g. batchable, queueable, futures). To get list view options, I ...
user avatar
  • 3,986
6 votes
Accepted

Possible to redirect to a page that uses standardSetController from another Visualforce page?

You can't redirect in Apex, because redirects require PageReference, and PageReference doesn't support having a single query string key with multiple values. However, you can do this in JavaScript by ...
user avatar
  • 438k
5 votes
Accepted

The CORRECT way to redirect to a ListView from StandardSetController?

Whoa. This works: public PageReference listView() { return new ApexPages.Action('{!List}').invoke(); //System.PageReference[/a09?fcf=00B24000004cfLK] } But is it documented?
user avatar
5 votes
Accepted

Peculiar StandardSetController Issue with Test Class

In this case, SelectedExamples is empty. You need to set the selected records in your test prior to instantiating your extension: StandardsObjectController.setSelected(listOfObjects);
user avatar
  • 14.5k
5 votes
Accepted

Unable To Cover StandardSetController.getSelected Loop

You never set the selected records. Break out your controller and extension constructors so you can do so. ApexPages.StandardSetController controller = new ApexPages.StandardSetController(cases); ...
user avatar
  • 144k
5 votes
Accepted

StandardSetController - how does it work?

The StandardSetController uses a database cursor to paginate through the results. Unlike using LIMIT+OFFSET, this method supports 10,000 rows of data, the results will not change each time a new page ...
user avatar
  • 438k
4 votes
Accepted

Change error displayed when wrong ID type is used with standard controller in visualforce

I don't think there's any way of modifying this page as it's one of the standard error pages produced by the server. This error is generated before your code even gets a chance to run so there's ...
user avatar
  • 24.7k
4 votes

Can We Write test Class for RecordsetVar with StandardController?

Since there is no controller involved in this ,there is no need to write any test code for this page . A test class is needed if you have apex controller linked to the Visualforce Page .
user avatar
4 votes
Accepted

How to get total number of pages in a standardSetController extension class

Decimals also have a round() method that you could use: size = 5.0; ... system.debug((setCon.getResultSize()/size).round(System.RoundingMode.CEILING)); Make sure that your size variable is ...
user avatar
  • 12.3k
4 votes
Accepted

Cross Site Scripting issue

Issue is with this line: standardSetCntrl = new ApexPages.StandardSetController(Database.getQueryLocator('SELECT Name FROM '+ strSelectedObject +' LIMIT 1')); This variable strSelectedObject would ...
user avatar
  • 22.3k
4 votes
Accepted

Lightning: Get list view records

Bit of a shot in the dark, but try calling setFilterId on your StandardSetController to get more deterministic behavior. public static final String DESIRED_LISTVIEW_LABEL = 'All'; public SomeClass(...
user avatar
  • 144k
4 votes
Accepted

Maximum stack depth reached: 1

Got it to work. In fact nothing to do with DML etc. It was related to duplicate variable usage. In my VF page my recordsetvar had the same name as a variable in my class : Page : <apex:page ...
user avatar
  • 2,413
4 votes
Accepted

Exception thrown by StandardSetController with Database.getQueryLocator?

There is no need for a try-catch block your code, because there is nothing you can catch that's worth catching. There's governor limits that could be exceeded, which you can't catch, and the ...
user avatar
  • 438k
3 votes
Accepted

Help with Apex test class: Getting no code coverage

You need to actually use the controller in the test. Here's an example of testing with Visualforce: http://www.eltoro.it/ArticleViewer?id=a07A000000NPRhkIAH In your case, that would include something ...
user avatar
  • 178
3 votes

StandardSetControllers Save Not Working

You should lazy-load your StandardSetController getter. Your submitExpenses method should not even compile, as you do not have any return statement. You should add error handling to your code. The ...
user avatar
  • 144k
3 votes
Accepted

What exactly is the StandardSetController?

StandardSetController can be created one of two ways, one being from a List<SObject>, and one being from a Database.QueryLocator. If you use the first form, it creates an internal backing array ...
user avatar
  • 438k
3 votes

Can a single VF page override both a standard action and a list action?

It is not possible for a single VF page to do this, but you can create 2 VF pages and have them use the same controller extension, using the same notation you used above. Single Record Handler <...
user avatar
  • 2,022
3 votes
Accepted

StandardSetController Test Class - 'Constructor not defined'

The StandardSetController class has two constructors, one accepts a list of sobjects and the other accepts a query locator. There is no constructor which accepts just a single record which is why you ...
user avatar
  • 22.4k
3 votes

Error in Test class

The problem is this line here: MassEditOppController objC = new MassEditOppController(new ApexPages.StandardController()); There's two problems; first, your constructor uses an ApexPages....
user avatar
  • 438k
3 votes
Accepted

How should I write and structure a good Apex Page Extension Test method?

They ask for one test method to cover the whole extension class and it's methods. When you're asked to do something specific, go ahead and do it, even if it's not your usual thing. As developers, we ...
user avatar
  • 438k
3 votes
Accepted

Is a "Content Source" of "Visualforce Page" required for Ids for the checked list view items to be received by a StandardSetController?

Yes you are correct. Maybe you have to create multiple VF pages but you could create a VF component that does the bulk of the work. Create an attribute to that component that is set via the page and ...
user avatar
  • 9,121
3 votes
Accepted

Filter Id value 00BXXXXXXXXXXXX is not valid for the Task standard controller

I did come across this known issue on the SFDC side; however, it didn't specify if it was classic only or not. I'm hypothesizing that this is largely due to the fact that Lightning appears to process ...
user avatar
2 votes

Standardsetcontroller methods first(),last(),next() and previous() not working

sw6, I think there may be an easier way to achieve what you want. Have you tried using the standard list controller for Cases? The Visualforce page below will enable you to navigate from page to page ...
user avatar
  • 4,291

Only top scored, non community-wiki answers of a minimum length are eligible