You need to sign in to do that
Don't have an account?
Rishabh Patel 1
Error Deleting campaign memebers
I have added a List button on campaign members that execicutes a javascript and deletes all campaign members in the campaign
I am Getting error-
{faultcode:soapenv:Client,Falultstrinf:Unexpected Element
{urn:partner.soap.sforce.com} type during simple type deserializition'}
Here is my Code
{!REQUIRESCRIPT('/soap/ajax/29.0/connection.js')} var result = sforce.connection.query("select Id from CampaignMember where Campaign.Name = '{!Campaign.Name}' "); var records = result.getArray("records"); var opt = confirm("Are you sure you want to delete selected records ?"); if (opt == true) { var errors = []; var delresult = sforce.connection.deleteIds(records); if (result && result.length) { var numFailed = 0; var numSucceeded = 0; for (var i = 0; i < result.length; i++) { var res = result[i]; if (res && res.success == 'true') { numSucceeded++; } else { var es = res.getArray("errors"); if (es.length > 0) { errors.push(es[0].message); } numFailed++; } } if (numFailed > 0) { alert("Failed: " + numFailed + "nSucceeded: " + numSucceeded + " n Due to: " + errors.join("n")); } else { alert("Number of records deleted: " + numSucceeded); } } window.location.reload(); }