简体   繁体   English

如何将数据发布到 Dynamics 365 多选选项列表?

[英]How can I post data to Dynamics 365 multi-select picklist?

I have 3 columns with data as follows from a file我有 3 列,其中包含来自文件的数据如下

FirstName       LastName        Notes

Tom         10001       Note 1
Bob         10002           11003 
Karen           10003       11004
Renee           10004       Note 3

I need to scan these and send to Dynamics 365 Contact entity using the new Multi-Select Picklist attributes.我需要使用新的多选选项列表属性扫描这些并发送到 Dynamics 365 联系人实体。

I can see that for example in the following provided on MSDN:例如,我可以在 MSDN 上提供的以下内容中看到这一点:

            OptionSetValueCollection activities = new OptionSetValueCollection();
            activities.Add(new OptionSetValue(1)); //Swimming
            activities.Add(new OptionSetValue(9)); //Camping

            Contact contact = new Contact();
            contact["firstname"] = "Wayne";
            contact["lastname"] = "Yarborough";
            contact["sample_outdooractivities"] = activities;
            _serviceProxy.Create(contact);

that this will update / create a contact.这将更新/创建一个联系人。

But in my situation do I need to scan the table and construct a contact object for each line or can I create one object and send?但是在我的情况下,我是否需要扫描表格并为每一行构造一个联系人 object 还是可以创建一个 object 并发送?
Also is sample_outdooractivities a field in the Dynamics 365 Contact entity? sample_outdooractivities也是 Dynamics 365 联系人实体中的一个字段吗?
In my case Note won't be so what will I need to put there?在我的情况下,注释不会,所以我需要在那里放什么?
Do I have to let the CRM know it is a multi-select picklist (as it is a virtual type in CRM)?我是否必须让 CRM 知道它是一个多选选项列表(因为它是 CRM 中的虚拟类型)? How can I do this using C#?如何使用 C# 做到这一点?

First of all, MultiSelect optionset is not a virtual field, it is physical datatype like below.首先,MultiSelect 选项集不是虚拟字段,它是物理数据类型,如下所示。 Read more 阅读更多

在此处输入图像描述

Also is "sample_outdooractivities" a field in the Dynamics 365 Contact entity? “sample_outdooractivities”也是 Dynamics 365 联系人实体中的一个字段吗?

Yes, sample_outdooractivities is one of its kind in Contact entity from MSDN sample .是的, sample_outdooractivitiesMSDN sample中的 Contact entity 中的一种。 The above sample code is the exact way to use it.上面的示例代码是使用它的确切方法。 Make sure your field is of the same datatype, but the sample data is quite confusing, LastName is blank or some numbers?确保您的字段具有相同的数据类型,但示例数据非常混乱, LastName是空白还是一些数字? Notes is a Multiselect picklist but having text sometimes & numbers sometimes? Notes是一个多选选项列表,但有时有文本和数字?

But in my situation do I need to scan the table and construct a contact object for each line or can I create one object and send?但是在我的情况下,我是否需要扫描表格并为每一行构造一个联系人 object 还是可以创建一个 object 并发送?

Yes, you have to read the each line from file & iterate through them, set in a new Contact object to create.是的,您必须从文件中读取每一行并遍历它们,在新的 Contact object 中设置以创建。

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

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