Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
error

We made a wrong turn. Try again.

Hello,

i need a quick action button to export contact data as csv. I have created a visualforce page which is related to a quick action button. But it doesnt really work proper.

In Classis it shows the cvs-data on the page. In Lightning is just start the download of the file. I want to start the download only if the quick action button is clicked. How can i achiev this?

VF-Page

<apex:page standardController="Task" extensions="CtrlContactExport" contenttype="application/vnd.ms-excel⌗Export_Contacts.csv">RNAME1;RNAME2;RSTREET;RHHOUSENO;RPOSTAL;RCOUNTRY;RPHONE;REMAIL

<apex:repeat value="{!list_contacts}" var="c" >

"{!c.Name}";"{!c.Salutation}";"{!c.MailingStreet}";"{!c.MailingStreet}";"{!c.MailingPostalCode}";"{!c.MailingCountry}";"{!c.Phone}";"{!c.Email}"

</apex:repeat>

</apex:page>

Controller

public class CtrlContactExport {

public list<Contact> list_contacts {get;set;}

public CtrlContactExport (ApexPages.StandardController controller){

exportContacts();

}

public Pagereference exportContacts(){

list_contacts = [SELECT Name, Salutation, MailingStreet, MailingPostalCode, MailingCity, MailingCountry, Phone, Email FROM Contact];

return new Pagereference('');

}

}

Thanks for advice

Peter

 
1 answer
0/9000