Open my visualForce page when user clicks on a custom button in a related list using salesforce
i am stuck on a issue.hope somebody can guide me.
I have created a Custom Object named Hello.
i have added 2 fields in it named Lead & Accounts.and they both are lookups.
Now i can see related list of my object under Accounts and leads as well
I wanna add a custom button to this related list that should open any other custom visual force page.
Now when i reached here:
Name>> Setup>> Create>>Objects>>Hello>>Custom buttons & links.
I created a new button.
Inside this i clicked "List Button"
I found an option "Display in existing window using SideBar"
I also chose Content Source as VisualForcePage.
but
there is nothing in the Content Dropdown.
How i created the开发者_如何学编程 page
Name>> Setup>> Develop >>Pages>>new>>MyNewPage
<apex:page standardController="Hello__c" extensions="MyExtentionFile">
</apex:page>
I tried many combinations of Standard and custom controllers but could not get success. hope somebody can help me.
I followed this link : http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_sosc_custom_button.htm
If you're creating a list button you'll also need to set the recordSetVar for it to show up as a potential content source for Hello__c. You can see this in action in the doc link from your question.
<apex:page standardController="Hello__c" recordSetVar="hellos" extensions="MyExtensionFile">
... more code here ...
</apex:page>
First, Ralph gave you the right answer.
Check to see how you named your "Plural" form of your custom object Hello__c. If you accepted the defaults, you would have:
- Name: Hello
- Label: Hellos
- Object Name: Hello
- API Name: Hello_c (or namespaceprefix_Hello__c)
Then with the following page and class, Content Source as VisualForcePage will display it as selectable:
Class:
public with sharing class Hello_Controller
{
public Hello_Controller(ApexPages.StandardSetController controller)
{
controller.setPageSize(10);
}
}
Page:
<apex:page standardController="Hello__c" recordSetVar="Hellos" extensions="Hello_Controller">
</apex:page>
精彩评论