I have a custom link titled Download on my Contacts page layout that when clicked currently takes me to the Export Report page with standard buttons Export and Done. I used the URL content source /00Oi0000002vZ5W?csvsetup=1 for the custom link to achieve this.
Now, instead of going to this page, I want the link to directly download the report in one click, just as clicking on standard Export button does. The URL doesn't change when Export is clicked, so I don't know how to achieve this with the URL method.
If URL is not possible, how can I do this using some other method, like OnClick JavaScript?
Best Answer
Try using
?export=1&enc=UTF-8&xf=xls
for the query string.e.g.
/00Oi0000002vZ5W?export=1&enc=UTF-8&xf=xls
You might want to change
&enc=UTF-8
with&enc=ISO-8859-1
depending on the file encoding you want.You can also get a CSV by changing the xf parameter to
&xf=csv
.In a custom button or link using window.open will prevent the current browser window being redirected.
window.open('/00Oi0000002vZ5W?export=1&enc=UTF-8&xf=xls');