function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ricardo Aguilar 4Ricardo Aguilar 4 

Custom button calling visualforce page not working

Hello, I am trying to create a custom list buttom to call a Visualforce Page, but I can't see the VF on the list when creating the button. I've checked out other similar questions in the developers Forums and I made sure the standardController for the object is already created. What else am I missing to call this VF page from the custom button? How can I can add this action/button to each record on the Master related list?
User-added image
I want the new custom button to apper in the related list for each record. See image below.

User-added image
in advance for your help!
Ravikant Ravikant 10Ravikant Ravikant 10
Hi Ricardo,

Kindly make sure that you visualforce page has standardSetController and not standardController as custom list button only supports viasualforce pages with standardSetController.
If this resolves your issue, kindly mark it as correct solution so that it helps others as well.

Thanks,
Ravi
vineet kumarvineet kumar
Hi Ricardo,

We can not add any Button/Action in the related list for each record-wise (known as Record-specific actions). But if you want to add any custom VF Button on the header of the Related list (known as Related list buttons) then you can do that. below find one image and you see one red colored box, there only on the header, all the selected related list buttons will be visible.

User-added image

But you can not add buttons at the record level (Record-specific actions). If you want to achieve that functionality then you have to create a custom Component.

Find the below instructions to add buttons in related list:

So for the related list button if you are not able to find VF page in the list as you mentioned above, use standard controller and recordsSetVar as below:


<apex:page standardController="Opportunity" recordSetVar="opportunities">  <I am using for Opportunity>

Once you do like above then you will be finding VF Page in the list and then Edit the Parent Object PageLayout and there go to related list Section like below

User-added image

And click on the Spanner icon as I marked in red color above. There You will find one Button Section and from there you can add the buttons.

Please let me know if you find any difficulties and mark as Best Answer if it helps you.


Thanks and Regards,
Vineet
SEKAR RAJ.SEKAR RAJ.
Hi Ricardo,
In order for a visual force page to appear while creating a custom button on a detail page, you must use the standard controller for the object that will appear on the detail page.
<apex:page standardController="SObject" recordSetVar="r">
</apex:page>
 
Thanks,
SEKAR RAJ