![](/img/trans.png)
[英]Can't connect to Dynamics 365 with Xrm.Tooling.Connector after 365 update
[英]Trying to add a delete record function to my web app that uses XRM tooling to update/edit records in Dynamics 365 and keep getting this error?
这是我目前收到的错误
我将在下面添加它连接到的删除代码的更多屏幕截图:
字符串 id 将它连接到我单击旁边的删除的特定记录。
下面是 CommonServices.cs 中的代码:
public bool DeleteEmployeeRecord(new_EmploymentHubCollegues employmentHubCollegue)
{
CrmServiceClient serviceClient = GetCrmServiceClient();
serviceClient.Delete(employmentHubCollegue);
return true;
}
下面是我的controller中的代码:
public ActionResult DeleteEmployee(string id)
{
ViewBag.Message = "Your application edit page.";
new_EmploymentHubCollegues Delete = _Service.GetCollegue(id);
return View(Delete);
}
[HttpPost]
public ActionResult DeleteEmployee(new_EmploymentHubCollegues Delete)
{
ViewBag.Message = "Your application edit page.";
if (_Service.DeleteEmployeeRecord(Delete) == true)
{
}
return View(Delete);
}
下面是我的 services.cs 中的代码
bool DeleteEmployeeRecord(new_EmploymentHubCollegues employmentHubCollegue);
当涉及更新或添加新记录(显然不同的变量名称等)时,我上面的代码有效。 我只是不确定如何删除 function。也许它不需要是布尔值?
您需要完成 CrmServiceClient.Delete 方法签名 -> 它接受两个参数,而不是一个。 第一个是实体逻辑名,第二个是实体的 ID。
我猜 new_EmploymentHugCollegues 是通过 crmsvcutil.exe 生成的早期绑定实体,因此您可以轻松地将方法修改为:
public bool DeleteEmployeeRecord(new_EmploymentHubCollegues employmentHubCollegue)
{
CrmServiceClient serviceClient = GetCrmServiceClient();
serviceClient.Delete(employmentHubCollegue.LogicalName, employmentHubCollegue.Id);
return true;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.