AnsweredAssumed Answered

Custom button to attach child objects attachments on generating documents is giving me an error message. An ideas on how to resolve this?

Question asked by austindyer on Mar 12, 2018

I have created a custom button on the opportunities object that is intended to attach all of a child objects attachments when the Document package is ran.


Here is the code I am using:




// the base LOOPlus URL 
var url = '/apex/loop__looplus?eid={!Opportunity.Id}&sessionId={!$Api.Session_ID}&parentIds='; 


// query Salesforce for the attachments 
var ids = sforce.connection.query("SELECT Id FROM Clients__c where Opportunity__c='{!Opportunity.Id}'"); 


// append the parent Ids to the URL 
if (ids && ids.size > 0) 
for (var i = 0; i < ids.size; i++) 
url += (ids.records[i] ? ids.records[i].Id: ids.records.Id) + ','; 




Any Ideas on what might be causing this?