+ Start a Discussion

VisualForce page embedded into custom object page layout

New to VF development, so pardon the newbie question


I have a custom object called Projects and would like to embedded a VF page of related cases on the page layout.  I have the VF page working as I like, but do not know how to.


1.  Embed the page into the Projects layout

2.  Once embedded, limit the VF page to only return cases related to the project.


This needs to be on both the view and edit pages of the project layout.


Any assistance is greatly appreciated


You'll need your VF page to use the Projects__c custom object as its standard Controller.  Embedded VF pages are only visible on the Detail View (not in the edit view). I may have syntax errors b/c I just typed into here but you should get the concept.I assume you have created a lookup from Case to your Projects object.  You'll need that field to query correctly off case.  Once you have made the VF page's standard Controller the same as your Custom Object, you'll need to go to the Projects__c layout and look for the VisualForce section to drag that page onto your layout.


<apex:page standardController="Projects__c" extensions="CustomController">

   <!--Markup here-->



public class CustomController{

  Projects__c myProject;

  List<Case> relatedCases;

private final ApexPages.StandardController controller;

  public CustomController(ApexPages.StandardController controller){

     this.controller = controller;

     myProject= (Projects__c)controller.getRecord();

relatedCases = [select Id, Name from Case where WhateverYourLookupFieldIs = :myProject.Id];




Hi gtuerk..


"Embedded VF pages are only visible on the Detail View (not in the edit view)."


How to make it visible in Edit too?..

(It just doesnt make sense to me why Salesforce make it only visible in Detail View)


Much Thanks in advance!