Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Setting optionset value in Entity to be saved?

$
0
0

I'm working on some C# code that interfaces with Microsoft Dynamics CRM.

At the beginning of my task, I had some code that looks like this:

Entity inquiryToCreate = new Entity("SomeEntity");
inquiryToCreate["firstname"] = "Bob";
inquiryToCreate["lastname"] = "Hunter";

_inquiryId = orgService.Create(inquiryToCreate);

This code works.  However, I have a task in which I must populate a third attribute.  This third attribute is picked from an optionset.  Suppose that I have three possible attribute values as follows 101="Private", 102="Sergeant", 103="Petty Officer".

If Bob hunter is a Private, how do I assign the value 101="Private" to an attribute?


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>