Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Visualforce CSV Example. Note the 'contentType' page attribute and the # to specify the file name.
This page must be accessed with an Account ID in the URL.
For example: https://<salesforceInstance>/apex/ContactsCsvPage?id=001D000000JRBet
<apex:page standardController='Account' contentType='application/'>
<apex:pageBlock title='Contacts'>
<apex:pageBlockTable value='{!account.Contacts}' var='contact'>
<apex:column value='{!contact.Name}'/>
<apex:column value='{!contact.MailingCity}'/>
<apex:column value='{!contact.Phone}'/>
Copy link

"contentType='application/". Excellent! It works! I appreciate your sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment