0

I'm trying to create PDF of account summary that includes related opportunities and campaign members of an account (hopefully to show a button on account page).

Before working on visualforce page, I am having trouble with apex class.

public class AccountRelatedOppCampaignmember {
public List<Opportunity> getOpportunities() {
    List<Opportunity> oppresults = [Select ID, CloseDate, 
                                    Amount, StageName, Name 
                                    from Opportunity where
                                    account=:SelectedValue];
return oppresults;}

public List<CampaignMember> getCampaignmembers() {
    List<CampaignMember> campresults = [Select ID, FirstName,
                                       LastName, Title from 
                                       Campaign Member where
                                       account=:SelectedValue];
return campresults;}}

I believe ":SelectedValue" is not the right way to call on particular account, but since I am so new to this, I am just unable to think of a way to phrase? it. I am not even sure if I was going in the right direction... Any help would be appreciated.

  • 1
    So...what does SelectedValue actually contain? – Adrian Larson Jan 9 at 15:19
  • If this is a controller extension, as it appears to be, you'll need to get the Account Id from your standard controller. That is the value you'd use in your Apex bind. – David Reed Jan 9 at 15:21

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.