2

The Attachments related list isn't showing up, what am i missing here?

<apex:page standardController="Event" extensions="EventExtension" tabStyle="Event" standardStylesheets="true" showHeader="true">
    <apex:sectionHeader title="Calendar" subtitle="{!IF(ISNULL(Event.Subject),'New Event',Event.Subject)}" />
    <apex:form >
    <apex:pageBlock title="Event Edit" mode="edit" tabStyle="Event" >

        <apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!saveEvent}" />  
            <apex:commandButton value="Save& New Task" action="{!saveAndNewTask}"/>    
            <apex:commandButton value="Save& New Event" action="{!saveAndNewEvent}"/>                  
            <apex:commandButton value="Cancel" action="{!cancel}" immediate="true" />                   
        </apex:pageBlockButtons>

        <apex:pageBlockSection title="Calendar Details" columns="2">

        </apex:pageBlockSection>        
    </apex:pageBlock>
    </apex:form>
   <apex:relatedList id="noteslist" list="NotesAndAttachments" subject="{!Event.id}" />
</apex:page>
3
  • Your code works for me. Is it something like Notes and Attachments are not enabled for Events (which would be bizarre)? – Scott Pelak Jun 21 '13 at 16:43
  • @amtorVitae when you go to setup--> develope --> API and click on Enterprise are you able to see notesandattachments related event parent objecT? – Rao Jun 21 '13 at 16:59
  • @nivyaj Start accepting a solution for some of your questions,most of your questions are having higher votes but no solution has been marked yet. These questions could be more helpful and useful for others if there was an accepted solution. – Rao Jun 21 '13 at 17:23
4

Answer

Try using list="Attachments" instead of list="NotesAndAttachments".

<apex:relatedList list="Attachments"  subject="{!$CurrentPage.parameters.id}" />

This sample is working fine for me.

<apex:page standardController="Event">
  <apex:detail relatedList="false"/>
  <apex:relatedList list="Attachments"  subject="{!$CurrentPage.parameters.id}" />
</apex:page>

Extra Info

I don't know why but Event seams not to be related to Notes.

I've used this snipped to check:

Schema.DescribeSObjectResult d = Event.sObjectType.getDescribe();
List<Schema.ChildRelationship> relationships = d.getChildRelationships();

String listOfRelationshipNames = '';
for(Schema.ChildRelationship rel:relationships){
    listOfRelationshipNames = listOfRelationshipNames + rel.getRelationshipName() + ', ';
}

System.debug(listOfRelationshipNames);

and this are the Event relationships:

USER_DEBUG [9]|DEBUG|Attachments, null, null, FeedSubscriptionsForEntity, RecurringEvents, Feeds, EventRelations, null, null,

1
  • 1
    Awesome, I was going to the Enterprise WSDL and looking for the exact name for notesandattachments, it does say "Attachments" – Rao Jun 21 '13 at 17:07
5

The relationship name for the Notes and Attachments related list has been changed in winter 14 release.

<apex:relatedList subject="{!account}"  list="CombinedAttachments" />

Based on the following link: https://developer.salesforce.com/forums/ForumsMain?id=906F00000008rzSIAQ

1
  • It worked for me. – sanchit May 3 '14 at 18:19
2

+1 for Martin's answer , always a better idea to look at the enterprise WSDL since it is readily available with the current updated schema and easy to access

    <complexType name="Event">
<complexContent><extension base="ens:sObject">
<sequence><element name="Account" nillable="true" minOccurs="0" type="ens:Account"/><element name="AccountId" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="ActivityDate" nillable="true" minOccurs="0" type="xsd:date"/>
<element name="ActivityDateTime" nillable="true" minOccurs="0" type="xsd:dateTime"/>

<element name="Attachments" nillable="true" minOccurs="0" type="tns:QueryResult"/>

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.