Reputation: 8079
Imagine a scenario where a phone call or an appointment is being marked as complete.
I've set-up a plugin to fire during the post operation of both these scenarios in which I attempt to delete another unrelated record (using the Organization Service delete method). The record which I try to delete has auditing turned ON. The delete fails and I receive a business process error. If auditing is turned OFF, the process is successful. Does anyone have any insight as to what the problem might be?
Upvotes: 1
Views: 287
Reputation: 619
This is not possible. Just add a function to the "Mark as Complete" button, to delete whatever record you want.
Or create a custom button with this logic behind it.
Hope this helps.
Here is the code to delete a record through JavaScript
// Identify the contact to delete.
var contactid = "89a7e456-8098-bb33-b345-0003gg9ff218";
var authenticationHeader = GenerateAuthenticationHeader();
// Prepare the SOAP message.
var xml = "<?xml version='1.0' encoding='utf-8'?>"+
"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"+
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+
" xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+
authenticationHeader+"<soap:Body>"+"<Deletexmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+
"<entityName>contact</entityName>"+
"<id>"+contactid+"</id>"+
"</Delete>"+"</soap:Body>"+"</soap:Envelope>";
// Prepare the xmlHttpObject and send the request,
var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Delete");
xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xHReq.setRequestHeader("Content-Length", xml.length);
xHReq.send(xml);
// Capture the result,
var resultXml = xHReq.responseXML;
// Check for errors,
var errorCount = resultXml.selectNodes('//error').length;
if (errorCount != 0)
{
var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
alert(msg);
}
Upvotes: 0