I've been struggling with creating code (I am not a developer) for a VP where all Campaign Members with certain fields completed (CampaignMember.Article_Link__c) are displayed in a table.
The goal is to have this information display for each company the campaign is for. The table shows up fine, but I can't figure out how to query the information correctly. Searching other people's code and trying to adapt for my needs isn't working; I always get a "illegal from list to list" error.
Apex
<apex:page standardController="Campaign" extensions="CampaignMembers">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!CampaignMember}" var="member">
<apex:column headerValue="Date">
<apex:outputfield value="{!CampaignMember.FirstRespondedDate}"/>
</apex:column>
<apex:column headerValue="Source">
<apex:outputfield value="{!CampaignMember.Source__c}"/>
</apex:column>
<apex:column headerValue="Outlet">
<apex:outputfield value="{!CampaignMember.CompanyOrAccount}"/>
</apex:column>
<apex:column headerValue="Placement">
<apex:outputfield value="{!CampaignMember.Article_Link__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Class
public with sharing class CampaignRelatedListExtension
{
public List<CampaignMember> campaignMembers { get; set; }
public List<Campaign> Campaign { get; set; }
public CampaignRelatedListExtension(ApexPages.StandardController controller)
{
CampaignMembers = [
SELECT CampaignMember.FirstRespondedDate, CampaignMember.Source__c, CampaignMember.CompanyorAccount, CampaignMember.Article_Link__c FROM CampaignMember
];
}
}
Goal: Tab: Company #1: date, source, outlet, link (20 records) Tab: Company #2: date, source, outlet, link (10 different records), etc.