I'm creating new Entity records in C#. The problem is my early-bound Xrm class is expecting the integer value of the Option List in question, but all I have is the string value of the Option List.
So, this is what I'd like to do. The problem is the "OptionListValue" in question is the integer value. You know; The auto-created one that's huge.
Is the only way for me to do this by finding out the value of that particular option? If so, what API do I use to get it and how do I use it? I'm expecting there's some Linq method of doing so. But I'm possibly assuming too much.
public void CreateNewContactWithOptionListValue(string lastName, string theOptionListValue)
{
using ( var context = new CrmOrganizationServiceContext( new CrmConnection( "Xrm" ) ) )
{
var contact = new Contact()
{
LastName = lastName,
OptionListValue = theOptionListValue // How do I get the proper integer value from the CRM?
};
context.Create( contact );
}
}