Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Visualforce Development
- :
- Adding Campaign Members to Account Page - Controll...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Adding Campaign Members to Account Page - Controller Issues
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-16-2012 09:42 AM
Hi,
I want to check if this is even possible.
I have created a stand alone Visuaforce page based on a custom controller pulling campaign members onto a single page that I want to be visible from the Account page.
Of course it seems to link a visualforce page by adding it as a section on the Account page, it needs to be powered by the Account standard controller.
Is it possible to write a visualforce page from the standard controller that can get data from as low down as Account>Contact>CampaignMember>Campaign so I can get all my fields?
Or alternatively is there a way to put a customer controller powered visualforce page on the Account page? Does the controller need to be 'Account' and add the following class as an extension?
I know this is basic stuff but after trawling the internet for an hour I'm alittle stuck.
Here's my current code for the stand alone page I have working;
public class myCampaignMembers {
/// Create a list
/// <OBJECT_NAME>
List<CampaignMember> rqs;
/// getReq() - Reffer to the list in the
/// visualforce page with "Req" minus the "get" from
/// controller name.
public List<CampaignMember> getReq() {
/// Get the data for the list
rqs = [select id, Campaign.Name, CreatedDate, Contact.ID, Contact.Title, Contact.FirstName, Contact.LastName, Contact.AccountID, Status FROM CampaignMember];
return rqs;
}
}
And my Visualforce Page....
<apex:page showHeader="false" sidebar="false" controller="myCampaignMembers" tabStyle="Contact">
<apex:pageBlock title="Campaign Members" id="CamMem">
<apex:dataTable value="{!Req}" var="CampaignMembers" cellPadding="4" border="1">
<apex:column >
<apex:facet name="header">Created Date</apex:facet>
<apex:outputField value="{!CampaignMembers.CreatedDate}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Campaign Name</apex:facet>
<apex:outputField value="{!CampaignMembers.Campaign.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Status</apex:facet>
<apex:outputField value="{!CampaignMembers.Status}"/>
</apex:column>
<apex:column >
<apex:facet name="header">First Name</apex:facet>
<apex:outputField value="{!CampaignMembers.Contact.FirstName}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Last Name</apex:facet>
<apex:outputLink value="{!CampaignMembers.Contact.LastName}">{!Camp aignMembers.Contact.LastName}</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">Title</apex:facet>
<apex:outputField value="{!CampaignMembers.Contact.Title}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Account</apex:facet>
<apex:outputField value="{!CampaignMembers.Contact.AccountID}"/>
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:page>
Solved! Go to Solution.
Re: Adding Campaign Members to Account Page - Controller Issues
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-17-2012 01:36 AM
In my opinion there is no way to get the data as low down as Account>Contact>.... without extension class.
Your alternative way is the only way:)
Inline Vf like
<apex:page standardController="Account" extensions="MyCampaignMembers">
</apex:page>
But you have to pay ur attention while creating of ur extension class you can get the current account id as a parameter from the constructor then you can query easily.
public MyCampaignMembers(ApexPages.StandardController std)
{
Sobject sob=std.getRecord()://HEre is the current record
}
SFDC Consultant & Software Engineer & Mathematician
Re: Adding Campaign Members to Account Page - Controller Issues
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-17-2012 01:42 AM
Thanks,
I'll give that a go.
So it's an extension! Thanks clearng that up.
Re: Adding Campaign Members to Account Page - Controller Issues
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-17-2012 01:50 AM
Could you mark my post as an answer ,if it helped you...Thank you...
SFDC Consultant & Software Engineer & Mathematician

