Hi, how can Skuid features be used to display the file attachments in Salesforce.

  • 3
  • Question
  • Updated 2 months ago
  • Answered
Hi, how can Skuid features be used to display the file attachments in Salesforce. We are exploring how Skuid can be used for KYC process where we can display the customer documents in a Skuid Page and the document checker can put his comments and decision on the Skuid page itself. The Skuid KYC page should pick up all SF attachments for that customer one by one. Thanks
Photo of SB


  • 90 Points 75 badge 2x thumb

Posted 2 years ago

  • 3
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,828 Points 20k badge 2x thumb
We've done something similar for other customers.  You can create a queue of all the attachments.  This presents a list that users can work through one at a time. 

Activating an entry in the queue will load the detailed attachment.   If customer documents are images you can display them in a template component.  Make sure the template is connected to the model that is loaded with attachment details.  The contents of the template will display the file using html image tags.   Something like <img src="/servlet/servlet.FileDownload?file={{AttachmentId}}"/> .     Replace "AttachmentId" with the field that is the ID of the attachment.

you can add height and width attributes to that img tag. 

If your files are PDF,  you can use the native PDF viewer in your browser. 

Hopefully this gives you some direction. 
Photo of Tim Shores

Tim Shores

  • 730 Points 500 badge 2x thumb
I found a way to both preview and download my files attached to records. I pieced this together courtesy of StackExchange and Salesforce documentation:

Note, this solution applies to Files in the ContentDocument object rather than the Attachment object, which we don't use at my org.

My model uses ContentDocumentLink, with conditions:
  1. LinkEntityId from source object of the record the File is attached to.
  2. ContentDocument.LatestPublishedVersion.IsLatest = true
I have a table that uses this model to get all Files for the record in the current page.

Row actions on my table:
  1. Preview is a Pop-up action that contains an Image component that uses my File model, with Source URL set to: /sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId={{ContentDocument.LatestPublishedVersion.Id}}
  2. Download is a Redirect to URL action, the URL is: /sfc/servlet.shepherd/version/download/{{ContentDocument.LatestPublishedVersion.Id}}
For Preview, there are three options for the thumbnail dimension URL parameter:
  1. THUMB120BY90
  2. THUMB240BY180
  3. THUMB720BY480
The biggest of these works best for documents in Word or PDF format, but it won't always look great with images. Looking through fields in objects like ContentDocument and LatestPublishedVersion, I don't see a field for file metadata, and I don't know of a way to query file metadata that would give you dimensions. But if there's a way to query file dimensions you could render your Preview buttons to choose the best THUMB dimensions.
Photo of Jack Sanford

Jack Sanford, Champion

  • 9,766 Points 5k badge 2x thumb
So helpful, thank you!
Photo of Michael Barnes

Michael Barnes

  • 210 Points 100 badge 2x thumb
Thanks for the tip here Tim!  Exactly what I was trying to accomplish as well!
Photo of Nicholas L.

Nicholas L.

  • 566 Points 500 badge 2x thumb
Just wanted to share a quick finding here in case anyone is struggling with getting a clear image preview. I was having trouble using these three:

  1. THUMB120BY90
  2. THUMB240BY180
  3. THUMB720BY480
None of these options seemed to bring back a clear picture. Found this thread online that mentions rendering as SVGZ: https://salesforce.stackexchange.com/questions/203030/content-document-download-url-params

And it works great!

Photo of Bill McCullough

Bill McCullough, Champion

  • 13,512 Points 10k badge 2x thumb

The Stack Exchange posting you linked also had a cool tip on how to download a list of files into a zip file.  I created demo page of how to do this.  I'm going to create a separate posting for this.


Photo of Nicholas L.

Nicholas L.

  • 566 Points 500 badge 2x thumb
Didn't even notice, but sweet! Thanks Bill!