Loading

Can't see images when accessed through Sites or Digital Experiences

Veröffentlichungsdatum: May 25, 2026
Beschreibung

When using the Salesforce SOAP API (enterprise WSDL) to query a rich text area custom field that contains images — for example, using a SOQL query like SELECT Resolution__c FROM myArticle WHERE ArticleNumber = '000001' AND PublishStatus='Online' AND IsLatestVersion = true AND Language='en_US'  — the returned result is an HTML img element with a src URL pointing to Salesforce internal servers.


When a user accesses this content via an Experience Cloud site or Force.com Site without being authenticated, the images do not display. The images only appear after the user logs in to Salesforce and refreshes the page.


This is expected behavior. Images stored in rich text area fields are accessible only within an authenticated Salesforce session. There is no API that retrieves the actual binary file of an image from a rich text area field for unauthenticated access.

Lösung

Option 1: Use a File Field or Documents Object Instead of Rich Text Area

Consider switching from a rich text area field to a File field type, or store your images in the Documents object. Both field types allow you to retrieve the actual file body via API query, enabling images to be displayed in unauthenticated contexts.
Refer to the Salesforce Knowledge documentation and the Salesforce API documentation for guidance on using file fields and the Documents object.

Option 2: Make Articles Publicly Available via Force.com Sites

You can make your images publicly accessible by publishing articles through a Force.com Site. Follow these steps:

  1. Create a Force.com Site.
  2. In the site's Public Access Settings, grant access to the Knowledge Article Type object.
  3. In Public Access Settings, grant access to the Knowledge Article's type fields that contain the rich text area fields with images.
  4. In 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, take the img src URL returned from your API query and replace the Salesforce internal domain with your Force.com Site public domain. For example:
From (internal access only): <REDACTED>[instance].content.force.com/servlet/rtaImage?eid=[articleId]&feoid=[fieldId]&refid=[refId]
To (public site access): https://[your-site].force.com/servlet/rtaImage?eid=[articleId]&feoid=[fieldId]&refid=[refId]

Option 3: Retrieve Articles via the Salesforce REST API

Salesforce Knowledge articles can also be retrieved via the Salesforce REST API. Refer to the Salesforce Knowledge REST API developer documentation for guidance on retrieving article versions programmatically.

Nummer des Knowledge-Artikels

000385938

 
Laden
Salesforce Help | Article