You need to sign in to do that
Don't have an account?

select criteria in standard set controller
Hello
I have a requirement wherein I need to have a custom button (Fetch records) in Account object List View, which will show only Name,Phone and Industry=consulting.
My vf page is working and I have added the button to list view and when I select AllAcounts it shows the vf page with records.
But I need only those records where Industry=consulting and here I am getting all the records.
Is my approach right ? pls guide me
I have a requirement wherein I need to have a custom button (Fetch records) in Account object List View, which will show only Name,Phone and Industry=consulting.
My vf page is working and I have added the button to list view and when I select AllAcounts it shows the vf page with records.
But I need only those records where Industry=consulting and here I am getting all the records.
Is my approach right ? pls guide me
public class AccountExt { //List<Account> acctList{get;set;} public AccountExt(ApexPages.StandardSetController controller) { } public List<Account> accountrec() { List<Account> acctList=[select Name,Phone,Industry from Account where Industry='Consulting']; ApexPages.StandardSetController ssc=new ApexPages.StandardSetController(acctList); //Instatiate standardsetcontroller return ssc.getRecords(); //getRecords method of StandardSetController } } <apex:page standardController="Account" extensions="AccountExt" recordSetVar="Accounts" tabStyle="Account" sidebar="false"> <apex:pageBlock title="Account"> <apex:pageBlockTable value="{!Accounts}" var="a"> <apex:column value="{!a.Name}" headerValue="Name"/> <apex:column value="{!a.Phone}" headerValue="Phone"/> <apex:column value="{!a.Industry}" headerValue="Industry"/> </apex:pageBlockTable> </apex:pageBlock> </apex:page>divya
Apex controller
Visualforce page
All Answers
Apex controller
Visualforce page