0
votes

I have 3 columns with data as follows from a file

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.

I can see that for example in the following provided on 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?
Also is sample_outdooractivities a field in the Dynamics 365 Contact entity?
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)? How can I do this using C#?

1

1 Answers

0
votes

First of all, MultiSelect optionset is not a virtual field, it is physical datatype like below. Read more

enter image description here

Also is "sample_outdooractivities" a field in the Dynamics 365 Contact entity?

Yes, sample_outdooractivities is one of its kind in Contact entity from MSDN sample. 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? Notes is a Multiselect picklist but having text sometimes & numbers sometimes?

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?

Yes, you have to read the each line from file & iterate through them, set in a new Contact object to create.