Created
September 30, 2011 14:22
-
-
Save recalde/1253878 to your computer and use it in GitHub Desktop.
Salesforce showFilePreview
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- This is an example of how to use the function --> | |
<a id="Title_069Q00000006bam" href="javascript:showPreviewDialog('069Q00000006bam', 'Title_069Q00000006bam', 'PDF');">Cover Sheet</a> | |
<!-- This is the javascript --> | |
<script type="text/javascript"> | |
function showPreviewDialogForContentDocument(contentDocumentId, titleElementId) { | |
var query = "SELECT Id, ContentDocumentId, FileType, CreatedDate "; | |
query += "FROM ContentVersion "; | |
query += "WHERE ContentDocumentId = '" + contentId + "' "; | |
query += "ORDER BY CreatedDate DESC LIMIT 1"; | |
var record = sforce.connection.query(query).records; | |
showPreviewDialog(record.Id, titleElementId, record.FileType) | |
} | |
function showPreviewDialog(contentVersionId, titleElementId, fileFormat) { | |
OverlayDialogElement.showFilePreview( | |
'docViewerOverlay', | |
titleElementId, | |
'/_swf/121310/sfc', | |
contentVersionId, | |
'chatter_bubble', | |
'false', | |
'docViewerContainer', | |
false, | |
fileFormat, | |
false); | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment