Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

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

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 ? ids.records.Id: ids.records.Id) + ','; 


Any Ideas on what might be causing this?

Labels: (1)
0 Kudos