gpt4 book ai didi

javascript - 如何使用 Dynamic CRM 端点从列表中删除联系人

转载 作者:搜寻专家 更新时间:2023-11-01 04:35:30 32 4
gpt4 key购买 nike

我有一个使用内置 DYNAMIC CRM 端点的 Angular 应用程序,主要是“/XRMServices/2011/OrganizationData.svc”,还有一些功能的“/api/data/v8.0”,包括调用将成员添加到营销列表。

此代码非常适合将成员添加到列表中:

function attachContactToList(memberGuid, listGuid) {
var data = {
"EntityId": memberGuid
};
var req = new XMLHttpRequest();
req.open("POST", "<<path to CRM Service>>/api/data/v8.0/lists("+ listGuid + ")/Microsoft.Dynamics.CRM.AddMemberList", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
req.onreadystatechange = null;
if (this.status == 200) {
notifier.alert("Added to List.");
} else {
raiseError(JSON.parse(this.response).error);
}
}
};
req.send(JSON.stringify(data));
}

但是,当我尝试使用 RemoveMemberList 调用从列表中删除成员时,它失败了。这是删除的代码:

function deleteListFromContact(memberGuid, listGuid) {
var data = {
"EntityId": memberGuid
};
var req = new XMLHttpRequest();
req.open("POST", "<<path to CRM Service>>/api/data/v8.0/lists(" + listGuid + ")/Microsoft.Dynamics.CRM.RemoveMemberList", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
req.onreadystatechange = null;
if (this.status == 200) {
notifier.alert("Removed from List.");
} else {
raiseError(JSON.parse(this.response).error);
}
}
};
req.send(JSON.stringify(data));
}

我得到的错误是:

{
"error":{
"code":"","message":"Request message has unresolved parameters.","innererror":{
"message":"Request message has unresolved parameters.","type":"Microsoft.Crm.CrmHttpException","stacktrace":" at Microsoft.Crm.Extensibility.OData.CrmODataRoutingConvention.SelectAction(ODataPath odataPath, HttpControllerContext controllerContext, ILookup`2 actionMap)\r\n at System.Web.OData.Routing.ODataActionSelector.SelectAction(HttpControllerContext controllerContext)\r\n at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
}
}
}

如有任何帮助,我们将不胜感激。这是我整个应用程序中唯一的绊脚石,一旦得到纠正......我很高兴。

谢谢

最佳答案

删除成员列表请求当前未实现:

https://msdn.microsoft.com/en-us/library/mt628816.aspx

Missing functions and actions for some organization service messages The following table lists the messages that don't have a corresponding function or action after Microsoft Dynamics CRM Online 2016 Update 1 and Microsoft Dynamics CRM 2016 Service Pack 1 are applied.

+------------------------------+-----------------------------------+----------------------------------+
| GrantAccessRequest | GrantAccessRequest | ModifyAccessRequest |
+------------------------------+-----------------------------------+----------------------------------+
| QualifyLeadRequest | ReactivateEntityKeyRequest | RemoveMemberListRequest |
+------------------------------+-----------------------------------+----------------------------------+
| RemoveItemCampaignRequest | RemoveItemCampaignActivityRequest | RetrieveByResourcesServiceReques |
+------------------------------+-----------------------------------+----------------------------------+
| RetrieveFilteredFormsRequest | | |
+------------------------------+-----------------------------------+----------------------------------+

您必须使用“/XRMServices/2011/OrganizationData.svc”或等到下一个版本。

关于javascript - 如何使用 Dynamic CRM 端点从列表中删除联系人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39921033/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com