14

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="edit"> <apex:pageBlockButtons> <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> <apex:...


11

ApexPages.StandardController (documentation) encapsulates just a single Sobject (e.g. Account, Opportunity). ApexPages.StandardSetController (documentation) contains a list of records (one or more), and has additional functions to facilitate pagination (moving between pages) and updating a number of records at once. For example in test class when we ...


9

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 in use in lots of orgs so was/am concerned about this breaking too. I'm now of the opinion that the problem is org specific. Here are the tests that I ...


8

It appears that the parameter was renamed to fcf at some point (or at least, using fcf as the parameter works when filterId is not always working in my experience). As this isn't documented anywhere, I don't know how supported it will be, but there does not appear to be an alternative (that I know of) at this point to set the filter on a ...


8

You can pass the standard controller to the component, allowing you to invoke its functions normally: public class ComponentControllerClass { public ApexPages.StandardController pageStandardController { get; set; } // Needed only because we are providing a second constructor public ComponentControllerClass() { } public ...


8

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 controller off with a simple collection (I'd prefer a Set<Id>, personally). public class PageController { public Set<Id> selectedRecordIds; ...


7

I think utilising the List View UI to allow your users to reuse this part of the platform is a great design decision btw! I've used this approach before and can tell you it does not matter what the original record set you select with your query selector is, so you can in fact use LIMIT 1. However, unfortunately the StandardSetController will only handle 10,...


7

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 set cannot be empty Try this: new ApexPages.StandardSetController(new List<Document>()); //ok! Same goes if you have an empty query result set. Cast the ...


7

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 public void getQuotes() { QuoteList = new list<Quote>([SELECT Id, QuoteNumber, Name, Status from Quote WHERE Status =: StatusPickvalue]); } ...


6

Why don't you create a collection of 1 to pass into your constructor? e.g. List<Opportunity> opps = new List<Opportunity>(); opps.add( [ Select Id From Opportunity Where Id = : cocr.Opportunity__c ] ); opportunityContactEntryExtension oCEE = new OpportunityContactEntryExtension(new ApexPages.StandardSetController( opps )); At the moment, you're ...


6

You can pretty much use soql OFFSET instead of standard set controller to achieve this as there wouldn't be more than 2000 profiles in reality


6

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 recommend having your Apex controller run SOQL query on ListView object filtered as needed. For example, @AuraEnabled public static List<ListView> ...


5

In this case, SelectedExamples is empty. You need to set the selected records in your test prior to instantiating your extension: StandardsObjectController.setSelected(listOfObjects);


5

Yes, you can get the ids of the records. In the constructor for your standardset extension, you can get the records using the following code: public List<sObject> myRecords {get; private set;} public MyClass(ApexPages.StandardSetController ctrl){ myRecords = ctrl.getRecords(); // - OR - myRecords = ctrl.getSelectedRecords(); //To ...


5

Set readOnly=true at the page level to query upto a maximum of 1M (10 lakh) records. <apex:page readOnly="true" controller="xxxxx"> ..... </apex:page> http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_controller_readonly_context_pagelevel.htm


5

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); controller.setSelected(cases); CreateReviewsController extension = new CreateReviewsController(controller); Also, you can simplify a lot of your setup related to ...


5

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 constructing a URL that passes in multiple ids values: /apex/pagename?ids=recordid1&ids=recordid2&ids=recordid3... This was mentioned in a post from ...


4

This may help you out -Pagination using List controller, you can also look into following post by Jeff Douglas


4

I wont completely rewrite the class for you but you can be very close to having this work with a standardSetController by doing the following Add a controller property for a soql string private string c_soql {get;set;} Set that property in your class constructor. Just create a soql query in string form soql = 'Select nameCase, statusCase From ...


4

If you still query for the large list it will be in memory at some point and you will still break the heap size limit. You would need to use the Database.QueryLocator version of the StandardSetController to avoid that. After each successful remove you will need to query the data back into the QueryLocator. public ApexPages.StandardSetController setCon { ...


4

I've actually suspected for a while that the WHERE or ORDER BY clauses given to the StandardSetController really don't make much difference once you have called setFilterId. I wrote this small test and grabbed the debug log (sadly the internal SOQL made by the setFilterId does not show). However it does prove the ORDER BY gets wiped, though the selected ...


4

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 nothing you can do to handle it. The only thing you could do navigate to a different custom page first that uses a custom controller, that controller could then ...


4

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 .


4

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 declared as a decimal. If you divide two integers, the fractional component of the number will be dropped, and your calculation will be one page short. If you do use ...


4

Issue is with this line: standardSetCntrl = new ApexPages.StandardSetController(Database.getQueryLocator('SELECT Name FROM '+ strSelectedObject +' LIMIT 1')); This variable strSelectedObject would be bound by Visualforce page. You should escape it as: String.escapeSingleQuotes(strSelectedObject); Look like: ApexPages.StandardSetController(Database....


4

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(ApexPages.StandardSetController controller) { if (!controller.getSelected().isEmpty()) return [SELECT Name FROM MyObject__c WHERE Id IN :controller....


4

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 standardcontroller="Opportunity" extensions="VFC05_MassAssignOwner_EBSAP" recordsetvar="opp" tabstyle="Opportunity"> Class: ...


4

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 exceptions that could be thrown can be avoided with some minor modifications to the code. NullPointerException If account is null, you'll get this. Just make sure your ...


3

You need to set the filter id after the page size, like so ... String query ='Select Id FROM '+objectName; ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(Database.getQueryLocator(query)); ssc.setPageSize(PAGE_SIZE); ssc.setFilterId(filterId); I imagine internally changing the page size causes the cursor maintained ...


3

This is a known QueryLocator Bug-Feature: The queryLocator value expires automatically after 15 minutes of inactivity. Here is the official SF-Doc: QueryLocator


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