We are trying to query a collection of custom entities in CRM 2011, using createquery:
var queryActivatedProducts =
from c in svcContext.CreateQuery("mur_activatedproducts")
where ((string)c["mur_activatedproduct"]).Contains("Feature")
select new
{
accountname = c.Attributes["mur_activatedproduct"],
};
foreach (var c in queryActivatedProducts)
{
Debug.WriteLine("" + c.accountname);
}
The code above is a modification of an example taken straight from Microsoft: http://msdn.microsoft.com/en-us/library/gg334415.aspx
We receive the following exception:
An exception System.FormatException was thrown while trying to convert input value '%Feature%' to attribute 'mur_activatedproducts.mur_activatedproduct'. Expected type of attribute value: System.Guid. Exception raised: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
Why is it asking for GUID here? If we follow Microsoft's example, it appears that this is where we want to input the string value of the attribute we are querying. We tried creating a new GUID object with the value of the entity we are searching and placing that here, but this failed as well. Any suggestions are greatly appreciated!