插件不会触发使用 CRM 2016 中的操作创建的自定义消息

Plug-in not triggering on the Custom Message created using Actions in CRM 2016

我创建了一个功能区按钮、一个空白操作(流程)和一个插件。我从功能区按钮调用操作 (JavaScript),它还需要使用自定义消息触发插件。我可以使用 soap 调用来调用操作,但它不会触发已在该自定义消息上注册的插件。我已经在成功弹出的辅助方法底部放置了一个警报,但是无法触发插件。感谢您的帮助....

function SendIOButtonActionCall() {
var entityId = Xrm.Page.data.entity.getId();
var entityName = Xrm.Page.data.entity.getEntityName();
var requestName = "vm_SendIOButton";
var OpportunityId = String(Xrm.Page.data.entity.getId());
ExecuteAction(entityId, entityName, requestName);
//window.location.reload(true);   
}

function ExecuteAction(entityId, entityName, requestName) {
    // Creating the request XML for calling the Action
var requestXML = ""
requestXML += "<s:envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";
requestXML += "  <s:body>";
requestXML += "    <execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";
requestXML += "      <request xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\">";
requestXML += "        <a:parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";
requestXML += "          <a:keyvaluepairofstringanytype>";
requestXML += "            <b:key>Target</b:key>";
requestXML += "            <b:value i:type=\"a:EntityReference\">";
requestXML += "              <a:id>" + entityId + "</a:id>";
requestXML += "              <a:logicalname>" + entityName + "</a:logicalname>";
requestXML += "              <a:name i:nil=\"true\">";
requestXML += "            </a:name></b:value>";
requestXML += "          </a:keyvaluepairofstringanytype>";
requestXML += "        </a:parameters>";
requestXML += "        <a:requestid i:nil=\"true\">";
requestXML += "        <a:requestname>" + requestName + "</a:requestname>";
requestXML += "      </a:requestid></request>";
requestXML += "    </execute>";
requestXML += "  </s:body>";
requestXML += "</s:envelope>";
var req = new XMLHttpRequest();
req.open("POST", GetClientUrl(), false)
req.setRequestHeader("Accept", "application/xml, text/xml, */*");
req.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
req.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");
req.send(requestXML); 
alert("success");
//Get the Response from the CRM Execute method
//var response = req.responseXML.xml;
}

function GetClientUrl() {
if (typeof Xrm.Page.context == "object") {
    clientUrl = Xrm.Page.context.getClientUrl();
}
var ServicePath = "/XRMServices/2011/Organization.svc/web";
return clientUrl + ServicePath;
} 

要检查的事项:

  1. 验证您的插件步骤是否已启用。
  2. 验证您的插件是否有效
    1. 在消息上注册您的插件步骤,例如针对某个实体的更新,看看您是否可以触发它。
    2. 将日志添加到插件中,看看是否可以让它记录一些东西
  3. 通过创建记录来验证您的操作是否有效。
  4. 使用 Fiddler 检查按钮生成的任何流量中是否返回任何错误。