function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GaurgkGaurgk 

Custom Export to csv button not working in vf page

Hi All,

I created aura component to display open activity records and to download all the records in the component using custom button (export to csv). For calling aura component as button I created vf page with lightning outapp. 
When I am previewing the vf page on console its displaying the related recordsScreenshot and downloading record in csv format(which is perfectly fine).

Problem: But when I am adding button on related list of open activities its showing the related records but not downloading in csv format. Its downloading in some unformatted file format and not able to see any records.

Kindly provide the suggestions. I am stuck with that I checked lots of link but nothing helpful.

Thanks in advance.
Suraj Tripathi 47Suraj Tripathi 47
Hi Gaurgk,
Greetings!

Your exported file doesn't have any extension.
So mansion the content type for exporting your file as CSV.

Add contentType="text/csv#Export.csv;charset=utf8" for vf page.

If you find your Solution then mark this as the best answer. 

Thank you!

Regards,
Suraj Tripathi
GaurgkGaurgk
HI Suraj,

Thanks for the response.

FYI, if I add the contenttype it will download the vf page and in my situation its downloading the code which i used to call aura component not the records which is getting dislayed through aura component.
Darisi MahidharkanthDarisi Mahidharkanth
Hi Gaurgk,
Did u find the solution for this?