Showing results for 
Search instead for 
Did you mean: 

Drawloop - How to get Images from Content Files


How to get Images from Content Files on a records related list.



*** Merging Images from content files is currently not a built-in managed feature. Below is a custom workaround using a custom formula field and SOQL.

1. Build a custom formula field on the Salesforce Files Object to form a URL to the Content document Image:

(Salesforce Lightning) Navigate to: SetupObject ManagerContent Version Fields & RelationshipsAdd New Field Type = Formula.
(Salesforce Classic) Navigate to: Setup Build Customize Salesforce Files Field Type = Formula.

This is a article attached imageThis is a article attached image

2. Create a formula field.
Formula for the URL field:
LEFT( $Api.Enterprise_Server_URL_100, FIND( ".com", $Api.Enterprise_Server_URL_100 ) + 4)& "sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=" & Id & "&operationContext=CHATTER"
Original:  (added =ORIGINAL_"&FileType&" Rather than the Thumb Version.)
LEFT( $Api.Enterprise_Server_URL_100, FIND( ".com", $Api.Enterprise_Server_URL_100 ) + 4)& "sfc/servlet.shepherd/version/renditionDownload?rendition=ORIGINAL_"&FileType& "&versionId=" & Id & "&operationContext=CHATTER"

3. Create the SOQL relationship in the DocGen Package:

Parent Object Files -SOQL: Copy Type = Table or Row
SELECT ContentDocument.LatestPublishedVersion.URL_Formula__c FROM ContentDocumentLink WHERE LinkedEntityId = '<<Parent_Object_Id>>' AND ContentDocument.FileType IN ('PNG','JPG','JPEG')

Table > Row Replicate Child Object - SOQL: Copy Type = Table
Select id, name, (SELECT ContentDocument.LatestPublishedVersion.URL_Formula__c FROM ContentDocumentLinks WHERE ContentDocument.FileType IN ('PNG','JPG','JPEG')) FROM Child_Object__c WHERE Parent_Object__c = '<<Parent_Object_Id>>'

** Please find the correct corresponding Child_Object__c & Parent_Object__c API names for your environment and the correct <<Parent_Object_Id>> tag.

4. Now the <<Tag>> The DocGen Template with the desired tags and behavior. Append ‘__image’ to the URL Formula Tag.
Image Documentation:

 Example below:
This is a article attached imageThis is a article attached image

5. The expected result is the Images will replicate and populate in the output document based on the Image URL from the formula field.



Labels: (1)
Version history
Revision #:
71 of 71
Last update:
a month ago
Updated by: