Posts

Showing posts from November, 2020

How to download the files using URL from salesforce

Note:   To download the file, require the  Content Version record Ids For Single File Use the below URL to download the single file from the salesforce. URL :    https://<YOUR_SFDC_BASE_URL>/sfc/servlet.shepherd/version/download/068XXXXXXXXXXXX   String idCntDoc = '068XXXXXXXXXXXX' ; String strURL = URL.getSalesforceBaseUrl().toExternalForm() + '/sfc/servlet.shepherd/version/download/' + idCntDoc; System.debug( 'URL ===> ' +strURL); For Multiple Files URL:  https://<YOUR_SFDC_BASE_URL>/sfc/servlet.shepherd/version/download/068XXXXXXXXXXXX/068XXXXXXXXXXXX above URL downloads the files in ZIP folder list<String> lstCntVersionIds = new list<String>{ '068XXXXXXXXXXXX' , '068XXXXXXXXXXXX' }; String strURL = URL.getSalesforceBaseUrl().toExternalForm() + '/sfc/servlet.shepherd/version/download/' ; for (String iterator : lstCntVersionIds) { strURL += iterator + '/' ; } strURL = strURL.removeEnd( '/...

File Preview in Visualforce salesforce

Ever notice how cool, the preview functionality in Salesforce Chatter is? Well, you can reuse the same component that Salesforce does.   Chatter uses a Shockwave Plugin to preview files. We can make use of the same plugin using the  <embed>  tag in VisualForce. Here's the tag: <embed src="/_swf/190003/sfc/flex/DocViewer.swf" flashvars="shepherd_prefix=/sfc/servlet.shepherd&v= <DocumentVersionId> &mode=chatter_bubble&in_tests=false" width="100%" height="100%" align="middle" id="renditionLarge" quality="high" bgcolor="#f3f3f3" name="renditionLarge" allowscriptaccess="always" allowfullscreen="true" pluginspage="http://www.adobe.com/go/getflashplayer" wmode="opaque" type="application/x-shockwave-flash"> The only thing you need to add to the link in the Document Version ID. (Not the Document ID) You get the Version ID f...