function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Itzik WinogradItzik Winograd 

javascript button from attachment

Hi Experts!
I would like to create a JS button under Account object,
that will show (if exsits) an attachment from the account named " photo.* " (all suffix are valid).
It can both show it as a popup window or as a hyperlink into the attachment page.
Any ideas? 
Thanks in advance for your help!
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Itzik,
  Account Id from the record you are on, then query the Attachment object for a parent with Id equal to the account Id you're on. You can add an additional filter on the attachment name to look for the word Photo, then grab the ID of the attachment to show in an Alert box. If you want the link to be clickable, your javascript will have to open a new window and show the URL as a normal HTML <a> tag

Thanks
Rahul Kumar
Itzik WinogradItzik Winograd
Got it! Thanks alot.