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
Ron929Ron929 

View All Campaign History - apex class

I set out originally to create a view all button for the campaign history related list.  Since I'm new to apex and a fairly inexperienced programmer, I am coming here for some help.  We do use person accounts so this may be more difficult than I anticipated.

 

The Campaign History related list is on the account record but still tied to the contact.  So I would first have to lookup the contact.id related to the account.id I am referencing.  I can do this with normal SQL, but since SOQL is just slightly different, I could use some help.  Here is the pseudo code.

 

Thank you in advance. 

 

 

public class CampaignHistoryExt { CampaignMember cm; Contact c; public CampaignMember[] getCampaignHistory() { CampaignMember[] cm = [select Id, Status from CampaignMember cm, Contact c where cm.contactid = c.id]; } }

 

 I figure that I would have to create a visualforce page with this class as an extension in order for this to work correctly.  I'm open to other ideas on how to get this to work if any are out there.  Thanks again.