Access Latest Attachment from List View and View it

edited September 1, 2016 in Questions
I have a list of Contacts and I'd like to be able to access their latest attachment via the list view.

(of course I think if I can make a URL on the contact detail itself I can also access this from the list view... maybe using a formula field?  This would be aweseome)

When clicking on this link or row action, it would be great if we can either, open a new tab with the latest document, do a pop up, or even better a scroll over view.  Really anything will suffice.

I found this online which allows me to create a button and utilize JavaScript.  https://success.salesforce.com/answers?id=90630000000hQ6jAAE

This is great on the Contacts detail record, but again I am trying to do this from a list view.

I'm guessing it is as easy as having a URL redirect to this.

<A Href = "/servlet/servlet.FileDownload?file={{{Id}}}"; Target = "_Blank"> {{Name}} </A>

Or setting up a pop up 

<iframe src="/servlet/servlet.FileDownload?file={{{Id}}}" style="width:100%; min-height:650px;"></iframe>

BUT.... how I get the most recent attachment ID from this Contact... that is a bit confusing because I can't really traverse the model from the list view.

Comments

  • Rob HatchRob Hatch 🛠️ 
    edited September 1, 2016
    In your models - fields properties you will notice a "child relationships" section.  This is where you add the attachment relationship fields to your model.  You can also specify filters on the child data,  sort order and number of rows returned.  I'd reccomend order by createdDate DESC  and only show one record. 

    Then you drag that child relationship item from the field list down into your table and it acts like a template component,  where you define a custom label and use syntax that looks like this.  

    <A Href = "/servlet/servlet.FileDownload?file={{{Id}}}"; Target = "_Blank"> {{Name}} </A>

    This will do what you are looking for. 
  • edited January 13, 2015
    Rob, Awesome.  I don't think I have messed with the child relationships yet.  I am going to find some new uses now!  Everything worked, but I did need to put {{Title}} instead of {{Name}}.  When I did {{Name}} nothing happened.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!