-1

Campaign Related list doesn't work. It gives me this error:

'Campaign History' is not a valid child relationship name for entity Lead

The code is below. Can anyone assist me?

Thanks,

Darko

<apex:page standardController="Lead" showHeader="true" wizard="false" readOnly="false" rendered="true" showChat="true" standardStylesheets="true"
      tabStyle="Lead"  >
   <style>
      .activeTab {background-color: #236FBD; color:white; width: 170px; height: 20px; padding-top: 6px; font-size: 12px; font-style: bold; border-top: none;
         background-image:none;}
      .inactiveTab { background-color: lightgrey; color:black; width: 170px; height: 20px; padding-top: 6px; font-size: 12px; font-style: bold; border: none;
         background-image: none}
   </style>

<apex:pageBlock id="block1">
    <apex:pageBlockSection id="section2" columns="2" collapsible="true" title="Important Information!" >




    </apex:pageBlockSection>
    <script>
        twistSection(document.getElementById('{!$Component.block1.section1}').getElementsByTagName('img')[0])
    </script>

</apex:pageBlock>
   <apex:tabPanel switchType="client" selectedTab="tabdetails" 
                  id="LeadTabPanel" tabClass="activeTab" 
                  inactiveTabClass="inactiveTab"  >   
      <apex:tab label="Details" name="LeadDetails" id="tabdetails" style="background-color: white;">
         <apex:detail relatedList="false" title="true" inlineEdit="true"/>
      </apex:tab>
      <apex:tab label="CampaignHistory" name="childCampaigns" id="tabContact" >
         <apex:relatedList subject="{!Lead}" list="Campaign History"  />
      </apex:tab>
      <apex:tab label="Opportunities" name="Opportunities" 
                id="tabOpp">
         <apex:relatedList subject="{!Lead}" 
                           list="Opportunities" />
      </apex:tab>
      <apex:tab label="Open Activities" name="OpenActivities" 
                id="tabOpenAct">
         <apex:relatedList subject="{!Lead}" 
                           list="OpenActivities" />
      </apex:tab>
      <apex:tab label="Activity History" name="ActivityHistory" id="tabActHist">
          <apex:relatedList subject="{!Lead}" list="ActivityHistories" />
      </apex:tab>
      <apex:tab label="Notes & Attachments" 
                name="NotesAndAttachments" id="tabNoteAtt" >
         <apex:relatedList subject="{!Lead}" 
                           list="CombinedAttachments" />
      </apex:tab>
   </apex:tabPanel>

</apex:page>
0

The answer to my problem. Instead of using Campaign History, I should use CampaignMembers.

<apex:tab label="Campaign History" name="CampaignMembers" id="tabContact" >
         <apex:relatedList subject="{!Lead}" list="CampaignMembers"  />
      </apex:tab>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.