For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to: Images & Related Lists

This page will guide the user through how to pull images from Salesforce Object Records that are stored in the Files or Attachments related lists.

<!--{{!
<lineitemsSOQL><class>table999</class>
<soql>select ContentDocument.latestpublishedversionid, ContentDocument.LatestPublishedVersion.pathonclient from contentdocumentlink where LinkedEntityId='{!ObjectID15}' AND (ContentDocument.LatestPublishedVersion.pathonclient LIKE'%.jpg%')
</soql>
<column prefix="<img src='/sfc/servlet.shepherd/version/download/" postfix="' width='150px' />">ContentDocument.latestpublishedversionid</column>
</lineitemsSOQL>
}}-->

Insert the above code snippet directly into the Template Editor's Source.

The above code snippet is searching for image's stored on the Object Record of type JPG. To generate properly, change .jpg in LIKE'%.jpg%' to the image format that was uploaded.

Images from Attachments

Images stored in attachments is considered legacy in comparison to storing images as Files/ContentDocuments. The Salesforce Lightning Experience will automatically convert uploads to Notes & Attachments to Salesforce Files. In order to upload Attachments, use Salesforce Classic.

In Salesforce Classic, Navigate to the Object Record, Select Attach File, upload the selected image. The following code block will now operate as expected.

Last updated

Was this helpful?