I´m trying to create an editable related list for Campaign Members, but can´t seem to reference a field (in my extension below) from the actual Campaign Member object (Description__c). I get a "No such column 'Description__c' on entity 'CampaignMember'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name" error within the Developer Console.

Which means it can´t be displayed in the visualforce page (the code "works", but instead of appearing as a table, it appears as an "SObject row was retrieved via SOQL without querying the requested field" error). Any ideas?

   public with sharing class CampaignRelatedListExtension
    public List<CampaignMember> campaignMembers { get; private set; }
    public CampaignRelatedListExtension(ApexPages.StandardController controller)
        campaignMembers = [
            SELECT Campaign.Name, Campaign.Startdate, Campaign.Type, Description__c FROM CampaignMember
            WHERE ContactId = :controller.getId()


And my vf page:

<apex:page standardController="Contact" extensions="CampaignRelatedListExtension">
 <apex:form >
    <apex:pageBlock title="Campaign Members">
        <apex:pageBlockTable value="{!campaignMembers}" var="member">
            <apex:column value="{!member.Campaign.Name}" />
            <apex:column value="{!member.Campaign.Startdate}" />
            <apex:column value="{!member.Campaign.Type}" />
            <apex:column value="{!member.Description__c}" />
  • 1
    You should edit your post to add your markup as well.
    – Adrian Larson
    Nov 18, 2016 at 14:36
  • I can copy-paste this code and markup verbatim and get no such error.
    – Adrian Larson
    Nov 18, 2016 at 14:48
  • @AdrianLarson, so adding in a Campaign Member field (to the extension) like that works for you?
    – user34868
    Nov 18, 2016 at 14:58
  • 2
    Yes, I simply copied what you have into my org and added that field. It compiled and ran without error.
    – Adrian Larson
    Nov 18, 2016 at 15:00
  • 1
    I also tested it and it works when added to the Contact's page. Tried to remove field-level security for a profile in that field, but it just does not display that column, no errors. Nov 18, 2016 at 15:19

1 Answer 1


As it turns out, there was no problem with my code. The problem was that I hadn´t refreshed my sandbox; the Description__c field (which I created recently) wasn´t recognized as a field belonging to the Campaign Member object, because as far as the sandbox knew, it didn´t even exist.

Thanks for your help, @Adrian Larson and @Mauricio Oliveira.

  • You can mark this as the answer. Nov 18, 2016 at 16:55
  • 1
    @citizenconn, I would, but it says that I have to wait for two days.
    – user34868
    Nov 18, 2016 at 17:04

You must log in to answer this question.