I need to display content of attachment within iframe that is embedded in the particular sObject.
When you upload file from notes&Attachments
related list on salesforce classic its type is attachment
and i have hard coded link for displaying content of this attachment
/servlet/servlet.FileDownload?file='[id of attachment]'
But when i upload this file from lightning its type is file
.
so is it possible to display content of ContentVersion
I guess or what its type is in iframe in the same way as attachemnt in my example?
Best Answer
You will need to query the contentLinkDocument records with the EntityId equal to the record Id .
And also ContentLinkDocument will give you Id of the content Document and you will need a query against content document to get the necessary file
Then SOQL on ContentDocument
Update
If you use Files or content related object there is a simple event with new lightning namespace which can be used
Here is a sample quick POC
Note that the default here is the Id of the content document .
The controller code for same is below