Use “Get Thumbnail” actionable to get the thumbnails of FILES in Salesforce and use in your document generation.
This approach allows the use of Salesforce-generated compressed thumbnail images. While these thumbnails are retrieved from Salesforce, the process is still subject to Salesforce’s API limits.
The number of images that can be retrieved depends on the size of the thumbnails, can be up to 20; however smaller images may allow more to be fetched at once, whereas larger images will result in fewer thumbnails being retrieved.
All this is available in a separate package. This package is ideal for situations where the customer does not want to enable the “API Enabled” permission or when using PDF Butler to manage images through the Salesforce Community or Experience Cloud.
Example: #
You can generate a document with this sample template, which will just display Thumbnails in table using this Actionable record type.
Doc Config #
Create a Doc Config record of Main Word Document Recordtype.
Actionable Record type- Get Thumbnail #
Create Actionable record of type “Get Thumbnail” to the above doc config as shown below.
Class: PDFButler_Actionable_GetThumbnailsV2
Actionable Record Type: Get Thumbnail
Get Thumbnail Files DataSource: Data Source that gets the FILES to use. This must be a SOQL Data Source and the SOQL must have following fields.
- ContentDocument.Id,
- ContentDocument.LatestPublishedVersionId,
- ContentDocument.FileType
For instance, the following Data Source retrieves all required records from the files linked to the record and filters out only the images (JPG/PNG). Of course you can use a Data Source that has a parent.
SELECT Id, ContentDocument.Id, ContentDocument.LatestPublishedVersionId, ContentDocument.FileType
FROM ContentDocumentLink
WHERE LinkedEntityId = :recordId
AND ContentDocument.FileType IN (‘JPG’, ‘PNG’)
Get Thumbnail Pictures DataSource: PICTURE Data source and this has to be a child of the Data source used for “Get Thumbnail Files DataSource” (Make sure that is does not select any data by setting field “Image Name” to “NotApplicable”) and the “Parent Query Field Name” must be “ContentDocument.Id”
Get Thumbnail Size: THUMB120BY90, THUMB240BY180, THUMB720BY480
Config type #
Open PDF Butler from Doc Config. Add two Data sources created in previous step. Use Picture Config type to hold thumbnails and show them in your document according to your requirement.