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
bikla78bikla78 

Visual Force Controller - nothing shows up under Content in page layout

How do I add this to my page layout? I want to be able to create a custom button or link on the contact page layout so that when I click it, it brings up all the related activities for that contact record using the query below. When I try to select this in the page layout nothing shows up under content. How can I select the vf page i created?

 

 

 

 

<apex:page controller="ActivityController">
<apex:pageBlock >
<apex:pageBlockTable value="{!Activities}" var="a">
<apex:column value="{!a.subject}"/>
<apex:column value="{!a.type}"/>
<apex:column value="{!a.ownerid}"/>
<apex:column value="{!a.whoid}"/>
<apex:column value="{!a.whatid}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
public class ActivityController
{

public Event[] getActivities()
{

list<Event> lstEvent = [Select id, subject,whatid, whoid, type, activitydate,ownerid from Event where id = :ApexPages.currentPage().getParameters().get('whoid')];
return lstEvent;
}

}

Message Edited by bikla78 on 08-03-2009 08:48 PM
paul-lmipaul-lmi

you're trying to pull "whoid" from a URL parameter, which isn't being passed, because your page layout is just loading the page.  if you want to test this out, try creating a custom link on your contact layout for /apex/<yourpage>?whoid={!contact.id}

 

you won't be able to embed this in the page as you've coded it now.  your controller would need a bit more work, and you'd probably be best suited by extending the standardController so you can make use of existing functionality, like getting the ID of the object on the current page without URL params.

dmsx2oddmsx2od

Have you read the developer books that salesforce.com publishes?  Go to developer.force.com and find the Developer Library.  All the info you need is in there.

Good luck!
David

bikla78bikla78

I added this custom link to the pagelayout but i get this error now. 

 

Since this is a visual force page, shouldnt this be selected udner content when i go to the contact page layout? If I add a contact link, it opens up another salesforce session within my current salesforce session.

 

Thanks for helping. I am pretty new to Visual force and I was able to get this far by readin the documentation

 

 

The page name can only contain alphanumeric characters, must begin with a letter, and must be unique.

https://cs2.salesforce.com/apex/<testclient>?whoid={!Contact.Id}