为什么我的代码无法添加活动

Why my code not able to add activity?

本文关键字:添加 活动 我的 代码 为什么      更新时间:2023-09-26

我正在尝试为联系人添加电话呼叫活动。我使用以下代码添加活动,但在活动列表中看不到它。

var ContactId = guid; //Contact GUID
var trigger = new XrmServiceToolkit.Soap.BusinessEntity("phonecall");
trigger.attributes["subject"] = "Hello";
trigger.attributes["regardingobjectid"] =
                     { id: ContactId, logicalName: "Contact", type: "EntityReference" };
triggerId = XrmServiceToolkit.Soap.Create(trigger);
}

如果我遗漏了什么,请提出建议。

您需要将contact作为logicalName传递。此:

{ id: ContactId, logicalName: "Contact", type: "EntityReference" };

应该是:

{ id: ContactId, logicalName: "contact", type: "EntityReference" };