Open related list record on Custom Button Click on Parent Detail Page
Requirement: Open All attachment record on a single button click means that , On Detail page of account there is custom button when click on this custom button open all attachment under the account Solution: Create a Custom Button on Account Level call a javaScript as mention below {!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/24.0/apex.js")} var query = "SELECT Id, ParentId FROM Attachment WHERE ParentId = '{!Account.Id}'"; var records = sforce.connection.query(query); var records1 = records.getArray('records'); //alert(records); if(records1.length>0){ //alert(records1.length); for(var i=0;i<records1.length;i++){ //alert('Test'+ records1[i].Id); window.open('/servlet/servlet.FileDownload?file='+records1[i].Id); } } Step 1 Create a custom Button on Account Level and write the JavaScript code as mention above refer the screenshot ...