如何在 Dynamics CRM 365 中为 'CallFrom' 和 'CallTo' 创建电话 Activity 的记录
How to create record for Phonecall Activity in Dynamics CRM 365 for 'CallFrom' and 'CallTo'
`if (!string.IsNullOrEmpty(phonecall.From))
phonecallEntity.Attributes.Add("from", new EntityReference("systemuser", new
Guid(phonecall.From)));
if (!string.IsNullOrEmpty(phonecall.To))
phonecallEntity.Attributes.Add("to", new EntityReference("contact", new
Guid(phonecall.To)));
我正在尝试在 Dynamics 365 中的 Phone 调用 activity 上设置起始和终止字段。我正在使用以下代码,但创建时起始和起始字段为空一个 Phone 调用。我需要更改什么?
Activity
实体上的 to
和 from
字段(行 Phone 调用)期望 EntityCollection
,而不是 EntityReference
作为你正试图通过它们。
您 EntityCollection
中的每个实体都应该是 ActivityParty
链接到 EntityReference
:
// Create your collection.
var collection = new EntityCollection();
// Create your parties; one party per reference (to/from).
var party1 = new Entity("activityparty");
party["partyid"] = new EntityReference(logicalName, id);
// Add your parties to your collection.
collection.Entities.Add(party1);
// Set your to phone call's to field.
phoneCallEntity["to"] = collection;
`if (!string.IsNullOrEmpty(phonecall.From))
phonecallEntity.Attributes.Add("from", new EntityReference("systemuser", new
Guid(phonecall.From)));
if (!string.IsNullOrEmpty(phonecall.To))
phonecallEntity.Attributes.Add("to", new EntityReference("contact", new
Guid(phonecall.To)));
我正在尝试在 Dynamics 365 中的 Phone 调用 activity 上设置起始和终止字段。我正在使用以下代码,但创建时起始和起始字段为空一个 Phone 调用。我需要更改什么?
Activity
实体上的 to
和 from
字段(行 Phone 调用)期望 EntityCollection
,而不是 EntityReference
作为你正试图通过它们。
您 EntityCollection
中的每个实体都应该是 ActivityParty
链接到 EntityReference
:
// Create your collection.
var collection = new EntityCollection();
// Create your parties; one party per reference (to/from).
var party1 = new Entity("activityparty");
party["partyid"] = new EntityReference(logicalName, id);
// Add your parties to your collection.
collection.Entities.Add(party1);
// Set your to phone call's to field.
phoneCallEntity["to"] = collection;