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.

Page I would like skipped

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?


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.


Javascript to download report in Excel format

  • Thanks, Daniel. It works fine. However, I'd also like to return to the same page (which is a contact record) or remain on the same page after the custom link is clicked. I tried /00Oi0000002vZ5W?export=1&enc=ISO-8859-1&xf=xls&retURL=%2F003i000000Bswj8 but nothing works - the blank page opens and the user has to manually click the back button on the browser to get back to the contact record where the custom download link is. – Rosh Jul 4 '13 at 2:35
  • 1
    Try using Javascript to open the link in a new window. I think most browsers will pull the file down and then close the window. – Daniel Ballinger Jul 4 '13 at 2:46
  • Could you please type out the JavaScript code? I'm new to this and therefore don't have a clue. – Rosh Jul 4 '13 at 3:04
  • Brilliant, thank you very much. Exactly what I wanted. – Rosh Jul 5 '13 at 8:51

protected by David Reed Oct 24 '18 at 11:24

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.