+ Start a Discussion
vinothvinoth 

how to use Notes and Attachments related list in visual force page?

I need to display the notes and attachments related list in visual force page.

Andy BoettcherAndy Boettcher

You'll need to create a custom list of these - you can't pull just the Notes and Attachments section from a standard Page Layout through.

 

-Andy

Devendra@SFDCDevendra@SFDC

 

Try this,

 

 <apex:relatedList subject="{!Job__c}" list="NotesAndAttachments" />

 

where Job__c will be custom object, for which you are displaying Notes and Attachments on vf page.

 

Hope this helps..:)

 

Thanks,

Devendra

 

 

vanessenvanessen
for my cases, the above code were not working, because i was in API version 29.0, thus for this version, i had to use the following code :
<apex:relatedList subject="{!Form__c}"  list="CombinedAttachments" /> 
where form__c is my object
munna123munna123
k but i have a scenario and not understanding where to place this related list to get notes and attachments for all records..

<apex:page controller="dynamic1" >
    <apex:form id="op">
        <apex:pageBlock >
            <apex:pageBlockSection id="od1"  >
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Object List"></apex:outputLabel>
                    <apex:selectList size="1" value="{!selectedobj}">
                        <apex:selectOptions value="{!objects}" ></apex:selectOptions>
                        <apex:actionSupport action="{!details}" event="onchange" rerender="op"/>
                    </apex:selectList>
                </apex:pageBlockSectionItem>
                <!-- <apex:pageBlockSectionItem >
<apex:outputLabel value="{!objdiscription}" ></apex:outputLabel>
</apex:pageBlockSectionItem>-->
                <apex:pageBlockSectionItem >
                    <apex:panelGrid columns="3" id="od" >
                        <apex:panelGroup style="width:40%" >
                            <apex:selectList size="6" value="{!sfields}" multiselect="true" style="width:200px;hieght:150px;">
                                <apex:selectOptions value="{!fnoption}"></apex:selectOptions>
                            </apex:selectList>
                        </apex:panelGroup>
                        <apex:panelGroup style="width:20%;hieght:120px;">
                            <table hieght="120px">
                                <tr><td><apex:commandButton value="Add" action="{!addfields}" style="width:80px;" reRender="od"  /> </td></tr>
                                <tr><td><apex:commandButton value="Remove" action="{!removefields}" style="width:80px;" reRender="od1"  /> </td></tr>
                            </table>
                        </apex:panelGroup>
                        <apex:panelGroup >
                            <apex:selectList size="6"  value="{!rfields}" multiselect="true" style="width:200px;hieght:150px;">
                                <apex:selectOptions value="{!fsoption}"></apex:selectOptions>
                            </apex:selectList>
                        </apex:panelGroup>
                    </apex:panelGrid>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:pageBlockTable value="{!mydata}" var="a" >
                        <apex:repeat value="{!myfields}" var="b">
                            <apex:column value="{!a[b]}"/>
                        </apex:repeat>
                    </apex:pageBlockTable>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <apex:commandButton value="click" action="{!querymydeta}" reRender="op"/>{!query}
        </apex:pageBlock>    
    </apex:form>
</apex:page>