Print this page

Users can't see images when accessed through portal

Knowledge Article Number 000176739

Scenario -
User has a website which connects to using the Soap API (enterprise.wsdl).
User is querying for a rich text area custom field which is used to upload images.

For instance, here is a SOQL Query where resolution is rich area text field used to upload images -
SELECT resolution FROM myArticle WHERE ArticleNumber= '000001' AND PublishStatus='Online' AND IsLatestVersion = true AND Language='en_US'

Issue -
The above API query result is a html img element (with src) to the actual image , which resides on Salesforce internal servers.

When the user accesses this record on the portal, images do not display.
When the user logins in Salesforce and refreshes the portal page then images appear.

Resolution Resolution -
This is working as designed.
Attempting to use the image url from an unauthenticated browser session results in the issue.
Images in the rich text area fields are meant to be "Salesforce internally available only" by default.
There is no api that will allow to retrieve the body\ actual file of an image file from a rich text area field.

Workaround -
1) Consider to switch to using a "file" field type instead of rich area text field and put your images there.
Put your images in the documents object.

Both allow you to get the actual body of the document via the API query call.
More information about this API query call can be found here-

Info on file field, Page 5 -

2) If you were doing this with Articles in Salesforce, articles can be retrieved via the REST API.

Make your articles publicly available, which makes them accessible via sites.
The basics are:-
  1. Create a Site
  2. The Public Access Settings for the site must allow access to the Knowledge Article Type object
  3. The site "Public Access Settings" must allow access to the Knowledge Article’s Type fields containing the rich text\images
  4. For the Knowledge Settings, enable "Allow users to share articles via public URLs"
  5. Publish your articles with the "Public Knowledge Base" channel selected.

Once this is done, you would need to then take the returned img src from your API query call, and substitute the domain there with the public site domain name.

So, if your site access url is:,
you will change your img src in example provided:
FROM (internal access only)

TO (Public site access)

promote demote