MaPi
MaPi

Reputation: 1601

Add drop down values to a CRM 2011 field using C#

Is it possible to add values to a CRM 2011's optionset via a C# application?

Upvotes: 0

Views: 588

Answers (2)

Daryl
Daryl

Reputation: 18895

These MSDN article, provide the code and examples for working with Global Option Sets

http://msdn.microsoft.com/en-us/library/gg509056.aspx

http://msdn.microsoft.com/en-us/library/gg509023.aspx

If you want to convert your local to global, check this out:

If you want to create Local Option Sets (the example is in javascript, but the same requests exist in the C# library):

http://mileyja.blogspot.com/2011/03/working-with-optionset-values-in.html

Upvotes: 1

Maks Martynov
Maks Martynov

Reputation: 458

Yes. You can set an option set value by:

OptionSetValue optionSet = new OptionSetValue();
optionSet.Value = 2; // optionset value is an integer
yourEntity["yourdropdown"] = optionSet;

Upvotes: 0

Related Questions