Use this Actionable when you have lot of pictures with large size to use in your document generation. Get Thumbnail URL fetches the URL of the pictures to make use of them in the document. These urls are sent to PDF Butler through “pdfbutler_url” variable. In the Doc config page, so make sure to add this variable in the data source where you are fetching picture files.
Example: #
In this article, you can see the steps to get the pictures which are saved in the files related list of children records. In this use case, I am generating the document from a custom object called Team and merging the pictures(that are in files) from the child object Players:
Parent Data Source: #
Create the parent data Source: This is a list sObject data source and it will allow us to get all the players related to the record from where we generate the document(In this case Team record). In this data source make sure you add the Id field:
Child Data Source: #
Create a child data source to get the files related to each child record:
You can create this data source with the SOQL builder and should include the below fields, also add the Grouping Field Name and the Parent Query Field Name, as mentioned before. These all can be done with the SOQL builder:
You can get the Thumbnails but also the full picture. If you want to get the full picture, you need to add the field
ContentDocument.LatestPublishedVersionId in the above Data Source.
So the SOQL query should be something like this below:
SELECT Id, LinkedEntityId, ContentDocumentId, ContentDocument.Id, ContentDocument.LatestPublishedVersionId FROM ContentDocumentLink WHERE LinkedEntityId IN :Id
These can be done using the SOQL Builder.
Actionable Record: #
In your Doc Config, you need to create an Actionable of type Get Thumbnails Url:
Below are the settings you need to add to the actionable:
Class: PDFButler_Actionable_GetThumbnailsUrl
Get Thumbnail Pictures DataSource: Select the Player files data source
Get Thumbnail Size: Here you need to select the quality of your pictures. In the latest version you have the option FULL which will retrieve the full picture. To use the FULL version, make sure you add in the data source the field: ContentDocument.LatestPublishedVersionId
SELECT Id, LinkedEntityId, ContentDocumentId, ContentDocument.Id, ContentDocument.LatestPublishedVersionId, ContentDocument.LatestPublishedVersionId FROM ContentDocumentLink WHERE LinkedEntityId IN :Id
Do not forget to activate it.
Doc Config: #
Create a Doc Config and open PDF Butler:
– Add the 2 data sources we have created:
– In the Player Files data source you need to add one field: pdfbutler_url. Which is a TEXT field:
– Create a picture data source as child of the Player files data source. To do it, click on the New Child button and then click on the Add dynamic picture datasource:
– The Picture data source should contain the below fields:
– You need to upload this sample template in doc config. The template will be something like this:
In this example, I have a table and then an inner table, but depending on the use case you can have a table where you replicate the payers and then you can use one of the row to replicate the pictures. Also do not forget to add merge field name to the the picture placeholder
– Then we need to add the config types:
We add a table config type and then inside a single config type to show the name of the player. Also inside the table config type, create a Table row config type where we are going to replicate the pictures attached to the record. Finally inside the Table row config type create a picture config type to merge the pictures.
Generate the document from the Team record, and it will be as shown below