简体   繁体   English

如何在Dynamics CRM 365中为“ CallFrom”和“ CallTo”创建电话活动记录

[英]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)));

I'm trying to set the from and to field on a Phone Call activity in Dynamics 365. I'm using the following code but the to and from fields are empty when creating a Phone Call. 我试图在Dynamics 365中的“电话”活动上设置“从”和“到”字段。我使用以下代码,但是在创建“电话”时,“到”和“从”字段为空。 What do I need to change? 我需要更改什么?

The to and from fields on Activity entities (line Phone Call) expect an EntityCollection , not an EntityReference as you are trying to pass them. 当您尝试传递Activity实体(电话线路)上的tofrom字段时,它希望使用EntityCollection而不是EntityReference

Each entity within your EntityCollection should be an ActivityParty linked to an EntityReference : EntityCollection每个实体都应该是一个与EntityReference链接的ActivityParty

// 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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM