You need to sign in to do that
Don't have an account?
alliswell
VF Page iwith custom controller to be used as button
Hi All,
Since I can't use recordsetVar for custom controller, how can i use a visualforce page (using custom controller) as a list button?
Thank you in advance!!
Hello,
Create your list in the custom controller and then display that through table in vf page like below
Controller
public class YourController{
public List<Account> accList{get;set;}
public YourController(){
accList = new List<Account>();
accList = [SELECT id,name from Account];
}
}
Visualforce
<apex:pageblochktable value="{!accList}" var="acc">
<apex:column headerValue="Account Name">
<apex:outputText value="{!acc.name}"/>
</apex:column>
</apex:pageblochktable>
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
souvik9086,
Really appreciate the time you have given here. Unfortunately, I don't think I communicated the problem in hand properly.
My question is
How can we use Visualforce Page(with custom controller and not the standard controller) as a Button in List view(as a button appearing in the Related list)?
Thanks!!
To add a custom button in the relatedlist of an object you have to use standard controller in that page and you can use extensions to give your custom controller name there and write your custom logic all in the custom controller.
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
So as to overide the custom object related list button of that object you will have to use standard controller of that object, and you can use recordsetvar(have tested it)... for custom functionality write extenssion...
for example if my custom object ai name is Hostel__c:
<apex:page standardController="Hostel__c" recordsetVar="rt">
This page will be available for overiding the realetd list button of custom object
Hit kudos and mark as answer if it helps.
/apex/VFPageName?id='recordID'
In the controller then you could get the ID parameter and then query for the list of records.
Thank you all for insights.
For my particular case, standard controller with extension w/ standardsetcontroller worked.
Thank you again!