Display Salesforce records, such as Campaigns and their attachments, in a custom Visualforce page styled with the Lightning Design System.
Use a standard list controller to list N records, and a controller extension to show the details of a single record.
Walkthrough
List N records
<apex:page
showHeader="false"
sidebar="false"
id="page"
lightningStylesheets="true"
showQuickActionVfHeader="false"
standardController="Campaign"
recordSetvar="campaigns"
>
<apex:slds />
<apex:param
value="Clienteling_Campaigns"
assignTo="{!selectedFilterId}"
name="selectedFilterId"
/>
<apex:variable var="campaignsSize" value="{!0}" />
<apex:repeat var="c" value="{!campaigns}" id="campaigns">
<apex:variable var="campaignsSize" value="{!(campaignsSize+ 1)}" />
<!--<apex:outputLink value="{!URLFOR($Action.Campaign.View, c.id)}">-->
<apex:outputLink value="{!URLFOR($Page.Clienteling_Details, null, [Id=c.id])}">
{!c.Name}
<apex:outputText value="{0,date,dd/MM/yyyy} - {1,date,dd/MM/yyyy}">
<apex:param value="{!c.StartDate}" />
<apex:param value="{!c.EndDate}" />
</apex:outputText>
</apex:outputLink>
</apex:repeat>
</apex:page>Details for 1 record
<apex:page
showHeader="false"
sidebar="false"
id="page"
lightningStylesheets="true"
showQuickActionVfHeader="false"
standardController="Campaign"
extensions="MyCampaignController"
>
<apex:repeat value="{!Campaign.CombinedAttachments}" var="attach">
<div style="margin:4px 0;">
<a href="/lightning/r/ContentDocument/{!attach.Id}/view"
>{!attach.Title}.{!attach.FileExtension} ({!attach.FileType})</a
>
</div>
</apex:repeat>
</apex:page>Going further
- Acquisition page: a custom Visualforce page with an Apex controller to collect data
- Apex cheatsheet: SOQL, triggers and callouts for your controllers