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

 

The image must be in the document, not an attachment.

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.Image_URL_Formula__c
FROM ContentDocumentLink
WHERE LinkedEntityId = '{pv0}' AND ContentDocument.FileType IN ('PNG','JPG','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:LATESTPUBLISHEDVERSION_FILE_IMAGE_URL}}{{TableEnd:FileImages}}

In Solution Manager, click Add Query Data.