c# - Create query with custom entity name in CRM 2011 -
After
We are trying to query a collection of custom entities in CRM 2011, using createquery:
var c queryActivatedProducts = svcContext.CreateQuery include ( "Mur_activatedproducts") where ((string) c [ "mur_activatedproduct"]) ( "the facility") new selection {account = c.Attributes ["Mur_activatedproduct"],}; Foreign currency (different types of query-serrated products) {Debug.WriteLine ("+ c.accountname"); }
The above code is a modification of examples taken directly from Microsoft:
We receive the following exception:
An exception to the system input While attempting to change the value '% feature%', the format expansion was thrown 'Mutuavirtualized Products' Mayr_ktivetprodkt 'required type of attribute values: System.Guid exception raised: Guid 4 dashes (XXXXXXXXXXXX-XXXXXXXX-XXXXXXXXXXXX) should be 32 points with Why
It is asking for here GUID.? If we follow the example of Microsoft, then it appears that this is where we ask that we want to input the string value of the attribute. We tried to create a new GUID object with the value of that unit, which we are searching for and keeping it here, but it is also unsuccessful. Any suggestions are very appreciated!
exception field is due to the datatype of mur_activatedproduct. It seems that this is a lookup in the CRM, so there is no reference to an entity and no string By this you have to define this field by defining an EntityReference, and filter by filter You want to use this filter
EntityReference er = new EntityReference ( "& LT; entityLogicalName & gt;", a new GUID ( "& LT; recordGuid & gt;")); // where your entityreference bridesmaid queryActivatedProducts = ctx.CreateQuery ( "mur_activatedproducts") c ((EntityReference) c [ "mur_activatedproduct"]) == er new selection {account = c.Attributes [ "mur_activatedproduct"],};
where (string) c ["mur_activatedproduct"]). Includes ("feature")
You have to change the field by a single line of text in the mur_activatedproduct CRM.
Comments
Post a Comment