Have a winapp that I am connecting to my CRM system, I am trying to fill a combobox with all currently active quote names, but if I look at the quote.statuscode its an option set, so how can I do this?
public void GetAllQuotes(ServerConnection.Configuration serverConfig, TextBox obj_txt_Status, ComboBox cmb_box)
{
try
{
// Connect to the Organization service.
// The using statement assures that the service proxy will be properly disposed.
using (_serviceProxy = ServerConnection.GetOrganizationProxy(serverConfig))
{
_serviceProxy.EnableProxyTypes();
_service = (IOrganizationService)_serviceProxy;
ServiceContext svcContexts = new ServiceContext(_service);
var quotes = from q in svcContexts.QuoteSet
//join a in svcContexts.AccountSet on c.ParentCustomerId.Id equals a.AccountId
//where (q.Name == "QUO-17583-G9D9")
where (q.Name.Contains("QUO-"))
//&& (q.StatusCode.Value == "active")
orderby q.Name
select new Quote
{
Name = q.Name,
StatusCode = q.StatusCode
}
;
foreach (Quote quote in quotes)
{
cmb_box.Items.Add(quote.Name);
}
}
}
// Catch any service fault exceptions that Microsoft Dynamics CRM throws.
catch (FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>)
{
// You can handle an exception here or pass it back to the calling method.
throw;
}
}
Matt