You need to sign in to do that
Don't have an account?
Squire Q Kershner
Custom Campaign Related List on Contact
My team has been asked to filter the Campaign History related list to only display "Active" Campaigns.
Since you can't filter with clicks, I assume I'll be needing to create a visualforce page that displays the filtered list,and then insert it into the page while removing the preexisting related list. The problem is that I'm not entirely sure where to start.
First question: Am I on the right track? The request is to only display Contacts with the "primary contact" checkbox selected on the account.
Second question: I've done simple visualforce related lists and some VF reports using standard controllers (thanks Mr. Workbook!) but this one is trickier because of the filter. I assume I'm going to need an extension to query for the related campaigns via the member record. This is where my skills start to drop off.
Third: I am more than willing to read/tutorial/play so any suggestions for documentation, examples, or otherwise is acceptable. Can anyone recommend a place to start there?
Since you can't filter with clicks, I assume I'll be needing to create a visualforce page that displays the filtered list,and then insert it into the page while removing the preexisting related list. The problem is that I'm not entirely sure where to start.
First question: Am I on the right track? The request is to only display Contacts with the "primary contact" checkbox selected on the account.
Second question: I've done simple visualforce related lists and some VF reports using standard controllers (thanks Mr. Workbook!) but this one is trickier because of the filter. I assume I'm going to need an extension to query for the related campaigns via the member record. This is where my skills start to drop off.
Third: I am more than willing to read/tutorial/play so any suggestions for documentation, examples, or otherwise is acceptable. Can anyone recommend a place to start there?
Question 1: Display only "Active Campaigns" related to the contact. I've already figured out that I need to go from Contact, to Campaign Member, to Campaign but my query doesn't appear to be working. Thanks in advance.
So, here's my class (so far)
public class activeCampaignsExtension {
public static void getData(id thisContact){
list<campaignmember> cm = [select id,campaignid from campaignmember where contactid =:thisContact];
system.debug(cm[0]);
list<campaign> camp = new list<campaign>();
for(campaignmember tempCM: cm){
campaign c = [select name, isactive from campaign where id=:tempCM.campaignid];
if(c.isactive == TRUE){
camp.add(c);
system.debug(c.name);
}
}
}
}
If I call this from EAC, using:
activeCampaignsExtension.getData('00319000002sj43');
I get the expected output in the debug logs.
I've pretty much reduced my Visualforce page to ruins by playing with it, so an updated version is coming. But I use the standard Contact controller on the page, and add the extension. I'll follow up with the VF page asap.
I think there are some core Visualforce concepts that you may want to review as you continue developing this Visualforce page on your own:
Each of these concepts take some time to learn and understand. I would recommend as a starting point that you go through the Visualforce Workbook[1], available for free from salesforce.com
[1]: http://www.salesforce.com/us/developer/docs/workbook_vf/workbook_vf.pdf