function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Haystack CertifiedHaystack Certified 

URL of Image in Feed Attachments

It is possible to get or construct the URL of an image in a Feed Attachment?  I tried using just the record ID, but that calls up the entire Files page.  I need the URL directly of the image.  The app I want to use this with runs inside of Salesforce so I don't think I need to be concerned with authentication.  Thanks.
Best Answer chosen by Haystack Certified
alouie_sfdcalouie_sfdc
I'm not entirely sure that this would work, but if you have the version id of the file (key prefix 068), you could try to use the same URL syntax as the links we mentioned above. The image part of your formual field could look like this:

IMAGE("https://your-content-domain.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=" & versionId, " ")

All Answers

alouie_sfdcalouie_sfdc
If you're using the Chatter REST API or Chatter in Apex, it's easy. In both cases, the feed item's attachment will have a downloadUrl property, as well as renditionUrl, renditionUrl240By180, and renditionUrl720By480 properties that you can use directly.

Chatter REST API docs:
http://www.salesforce.com/us/developer/docs/chatterapi/index_Left.htm#CSHID=connect_responses_feed_item_attach_content.htm|StartTopic=Content%2Fconnect_responses_feed_item_attach_content.htm|SkinName=webhelp

Chatter in Apex docs:
http://www.salesforce.com/us/developer/docs/apexcode/Content/connectAPI_outputs.htm#capi_content_attachment_output

Hope that helps!
Haystack CertifiedHaystack Certified
Thanks.  I was able find what you mentioned using workbench.  Is there a way to adjust this so that it could be used in a formala field?  I would like to put the image onto a page layout.
alouie_sfdcalouie_sfdc
I'm not entirely sure that this would work, but if you have the version id of the file (key prefix 068), you could try to use the same URL syntax as the links we mentioned above. The image part of your formual field could look like this:

IMAGE("https://your-content-domain.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=" & versionId, " ")
This was selected as the best answer