Set nullable types in Dynamics 365 & C#

1 min read

Summary

A little code snippet demonstrating how to set nullable types in Microsoft Dynamics 365 CE.

The code

// Set a Two Options to null
bool? nullOption = null;
entity["myoption"] = nullOption;

// Set int to null
int? nullNumber = null;
entity["mynumber"] = nullNumber;

// Set OptionSetValue to Null
OptionSetValue myNullOption = new OptionSetValue();
myNullOption = null;
entity["new_optionset"] = myNullOption;

You must be logged in to post a comment.