web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

How to set "multi select option set" in plugin using Developer tool kit. D365 online VS 2017

(0) ShareShare
ReportReport
Posted on by 170

Reading multi select option from a record and setting to the other record .. below is the code which is not working. Please suggest. 

if (entAcc.wpo_invoicefrequencymonth_t != null)
{
entAccountUpdate.wpo_invoicefrequencymonth_t = entAcc.wpo_invoicefrequencymonth_t;
}

I have the same question (0)
  • LeoAlt Profile Picture
    16,331 Moderator on at
    RE: How to set "multi select option set" in plugin using Developer tool kit. D365 online VS 2017

    Hi partner,

    If you want to set multi select option to other record, you could use the following code.

    Get multi select option value

    Entity entity = _service.Retrieve("account", new Guid(old RecordId), new ColumnSet("new_multioption"));
    Entity accountEntity = new Entity ("account", new Guid(New RecordId));
    
    accountEntity["new_multioption"] = entity.GetAttributeValue("new_multioption");

    Set multi select option value (single value)

    OptionSetValueCollection collectionOptionSetValues = new OptionSetValueCollection();
    
    OptionSetValue optionSet = new OptionSetValue(optionsetValue);
    
    collectionOptionSetValues.Add(optionSet);
    
    entityAccount["new_multioption"] = collectionOptionSetValues;
    _service.Update(entityAccount); 

    Set multi select option value (multi value)

    string[] arr = { collection of option set value };
    
    foreach(var item in arr)
    {
    collectionOptionSetValues.Add(new OptionSetValue(Convert.ToInt32(item)));
    }
    
    entityAccount["new_multioption"] = collectionOptionSetValues;
    _service.Update(entityAccount);

    You could also refer to the following links.

    https://www.inogic.com/blog/2018/09/multi-select-option-set-field-in-dynamics-365-v9-0/

    https://itsfascinating.com/d365/tag/multiselect-option-set/

    https://www.encorebusiness.com/blog/multi-select-option-sets-in-dynamics-365-customer-engagement/

    Best Regards,

    Leo

  • Suggested answer
    meelamri Profile Picture
    13,216 User Group Leader on at
    RE: How to set "multi select option set" in plugin using Developer tool kit. D365 online VS 2017

    Hey,

    I understand your pain, Developer tool kit use SDK V8. MultiSelectOptionSet need the V9.

    Please check this blog:

    community.dynamics.com/.../setting-up-developer-toolkit-for-vs2019-with-core-assemblies-9-0

    I used the same idea to setup the V9 SDK in VS2017. It works for me !!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 125

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 98 Super User 2025 Season 2

#3
Erin Lubben Profile Picture

Erin Lubben 73

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans