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

VF Page on a Related List

I have a requirement to create a VF page1 and add it to a related list of an object. The custom VF page1 should display column A, column B, Column C and a “New” button.
When the “New” Button is clicked, it should pop up a new VF page2 on which a user can select values for Column A, Column B, Column C and click save button which closes that VF page2 and displays all related user entered information on VF page1 on the related list.
Anyone has any sample code for that. Please let me know.
SonamSonam (Salesforce Developers) 
You can achieve this through a Wrapper Class on a VF page:

Create VF page1 with Wrapper that shows the list of records with chechboxes to select the rows > Create a button this page which redirects to VF page 2 and displays the selected values there.

You can embed VF page 1 in the standard page layout:

Sample code on the link below:
RamuRamu (Salesforce Developers) 
It is not possible to add a visualforce page as the related list to the standard page layout. The alternative would be to add the visualforce page as a component within the page layout or create a complete visualforce page and use show the data as the related list using pageblock table or repeat etc..,

Thanks for the reply. But I don't need to select any list of records on VF page1 . VF page 1 should just display the information that user entered on VF Page2 fields. The VF page2 should pop up and display the fields once the user clicks on the "New" Button on VF Page1.

Please let me know if you have any suggestions on this.


Thanks for the reply. Yes you are correct. I need to create a VF page with pageblock table and add it to the page layout instead of Related list.

Here I need to develop two different VF pages as described above. Do you have any sample code according to my above requirement.