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. Navigate to Salesforce SetupSalesforce FilesFields to create a custom field on the Salesforce File Object.
  2. Create a new formula text field and name the field. For this example, the field name is File Image URL.
  3. Enter the following URL: LEFT( $Api.Enterprise_Server_URL_100, FIND( ".com", $Api.Enterprise_Server_URL_100 ) + 4)& "sfc/servlet.shepherd/version/download/" & Id
  4. Create a Conga Query with this syntax: 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
  5. In the button URL, add the Query: &QueryID=[FileImages]IDofQuery
  6. In the template, the following should appear: {{TableStart:FileImages}}{{IMAGE:LATESTPUBLISHEDVERSION_FILE_IMAGE_URL}}{{TableEnd:FileImages}}
  7. In Solution Manager, click Add Query Data.