Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Is there a particular url I can put into a custom link or button that will link to a chatter file, that when clicked will download the most recent version?

I know I can use the download url to get a specific version, but that involves an admin updating the button everytime the file version changes.

share|improve this question

2 Answers 2

The core URL for the Chatter file should always reference the current version. But this only works if the users remember to use the "Upload New Version" option. I find a lot of people just do a new upload, which duplicates the file.

So, the custom button or Link could be literally just the file ID. For example:

/069E0000000cNrX

The only reason to use an explicit version is when you want something other than the current version of the doc. Replace the hard coded value for an ID variable and you're off and running.

share|improve this answer
    
But that doesn't address the auto download part..... –  ChrisN Jan 23 '13 at 13:41

After inspecting the standard download links for chatter files, I came up with a apex function which returned the file download links. You can try creating the link for download in the following format -

String FileDownloadUrl = URL.getSalesforceBaseUrl().toExternalForm()+ '/sfc/servlet.shepherd/version/download/' + FeedItem.RelatedRecordId + '?asPdf=false&operationContext=CHATTER';
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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