Search code examples
c#.netdynamics-crmodata

How to update D365 multi-select picklist to an empty value (no selections) using OData?


We have a custom field in an entity in Microsoft Dynamics 365 (dataverse). It's a multi-select picklist, so the OData API exposes it as a string (comma-separated value).

Setting values to the field is easy, we just set the string to a value, e.g. "1, 2, 3" and save.

But if we want to clear all selections (the field is set to "Optional"), then we get an error "Edm Object passed should have the options selected".

I've tried sending just a space, but then I get an error "The optionset values sent are not valid integers."

I cannot find any examples in the official documentation (https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/multi-select-picklist?view=op-9-1)

So how do I clear the pick list from selected values using OData API and Microsoft OData Client (.NET)?


Solution

  • In Dynamics 365 CE / Dynamics CRM / Dataverse, if you want to clear a field you set it to null, this is valid for all types including multi-select optionsets (Choices)