Skip to main content
Conga Support

FILE is the related List or in Attachments and you need an IMAGE

When FILE is the related List or there is a file in Attachments and you need to grab an IMAGE

1. You must create a custom field on the Salesforce File Object. Select Salesforce Set-up -> Salesforce Files -> Fields.

2. Create a new formula text field and name the field. For this example, the field name is File Image URL.  Enter the following URL: 

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"

3. Create a query.

Select ContentDocument.Latestpublishedversion.File_Image_URL__c

FROM ContentDocumentLink

WHERE LinkedEntityId = ‘{pv0}’

AND (ContentDocument.Latestpublishedversion.FileType LIKE '%png%' OR ContentDocument.Latestpublishedversion.FileType LIKE '%jpg%' OR ContentDocument.Latestpublishedversion.FileType LIKE '%jpeg%')

If you want to filter with the title instead of the file type, then use this field: ContentDocument.Latestpublishedversion.Title 

4. In the button URL,add the Query: &QueryID=[FileImages]IDofQuery

In the template, you should see: 

{{TableStart:FileImages}}{{IMAGE:CONTENTDOCUMENTLATESTPUBLISHEDVERSION_FILE_IMAGE_URL}}{{TableEnd:FileImages}}

In Solution Manager, click Add Query Data.