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
Flight PlanFlight Plan 

Displaying Image

Hi All,

 

 

How we can display the image/document (PDF/XLS) that we have uploaded in salesforce Attachment / Document object in site.com (it should be available publically)?

 

 

 

Any pointers on this would help.

 

laura.mckevitt@bakertilly.comlaura.mckevitt@bakertilly.com

Hi,

 

So if I understand correctly, you've added some sort of content to the Documents section of the database and made it externally available. If so, then you should be able to obtain the URL of the content by right clicking on the image generated and Copy Image URL or if it's a document you can click View File and grab the URL from the address of the browser. You should get a result like one of the following:

 

https://mycompany--c.na1.content.force.com/servlet/servlet.ImageServer?id=015300000021pHR&oid=00D30000000o0sW&lastMod=1339530218000
https://mycompany--c.na1.content.force.com/servlet/servlet.FileDownload?file=015300000021pHR

 

Now, to use that within Siteforce (let's say an image), easiest way would be to create a Custom Code Page Element and insert the following where your URL above is the SRC below:

 

<img src="https://mycompany--c.na1.content.force.com/servlet/servlet.ImageServer?id=015300000021pHR&oid=00D30000000o0sW&lastMod=1339530218000" alt="My Siteforce Image"/>

 

For documents that would display in a new window, I would do the following:

 

<a target="_blank" href="https://mycompany--c.na1.content.force.com/servlet/servlet.FileDownload?file=015300000021pHR" title="My Siteforce Document">Click Here to Open My Siteforce File</a>

Does that help to answer your question?

 

Thanks,

 

Laura

 

 

Flight PlanFlight Plan

Hi Laura,

 

Thanks for the reply.

 

After investigation I also realized that displaying image in site.com which is stored in SF Document object follows the same step as you mentioned.

 

Again in document we have option "Externally Available Image" means this image is externally available so after publishing the site image is available.

 

Does the same approach works for Document containing PDF/XLS/WORD file ?

 

In Document help section of Document object I found this

 

Externally Available Image

" A checkbox that indicates if the document is an image available for HTML email templates, such as a logo in a letterhead, and does not require a Salesforceusername and password to view in an email.

This checkbox indicates if the document is an image used as a custom app logo or custom tab icon, which require a Salesforce username and password to view."

 

 

 

Will they available externally like images when site get published (Right now I don't have publisher license )?

 

Any input on this would help me.

 

 

 

 

 

 

laura.mckevitt@bakertilly.comlaura.mckevitt@bakertilly.com

Hi,

 

When you upload a non-image file, the checkbox is not available. Following the instructions in my original post to get the URL for that document and then using it within Site.com will work. I have tested on my end as published.

 

Is there any reason for the requirement to use Documents versus adding it to Site.com as an asset? To save on data storage you could add the path to the site.com file within Documents. Additionally, you could utilize Content Deliveries as well. Just some thoughts if you are flexible in your design.

 

Hope that helps, 

 

Laura

Flight PlanFlight Plan

Hi Laura,

 

The reason behind this approach is, from salesforce user would add the Product details and upload  images associate with it.

And in site.com we have to display product list with images.

 

If we are using site.com Asset to store the product images then user has to manually add the relative path of image in product object refer this field using repeater in site.com which I think is not a good approach.

 

This is the case for image similary for documents (PDF/XLS/WRD)

 

As you mentioned, if a non-image file is uploaded in SFDC document object and refer its URL in site.com then on publishing the site this document(PDF/XLS?WORD) will be available and does not  require  a Salesforce username and password to view .

 

laura.mckevitt@bakertilly.comlaura.mckevitt@bakertilly.com

That makes perfect sense - we actually created our own custom object to store information/asset paths across multiple sites and wanted the flexibility to change that on a per site basis if needed.

 

Good luck and hope that testing helped out!