locked
Linked query in CRM 2011/2013 RRS feed

  • Question

  •  Microsoft.Xrm.Sdk.Query.QueryExpression query = new Microsoft.Xrm.Sdk.Query.QueryExpression();
     query.EntityName = "template";
     query.ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet("title", "description", "templatetypecode", "ispersonal");
     EntityCollection collection = _service.RetrieveMultiple(query);
                        //  _service.RetrieveMultiple(retrieve);
                        // Execute the request.

                        if (collection.Entities.Count > 0)
                        {

                            templateDetailsList = (from be in collection.Entities
                                                   select new TemplateDetails
                                                   {
                                                       Id = new Guid(be.Attributes["templateid"].ToString()),

                                                       title = be.Attributes.Contains("title") && be.Attributes["title"] != null ? be.Attributes["title"].ToString() : string.Empty,
                                                       description = be.Attributes.Contains("description") && be.Attributes["description"] != null ? be.Attributes["description"].ToString() : string.Empty,
                                                       Type = be.Attributes.Contains("templatetypecode") && be.Attributes["templatetypecode"] != null ? be.Attributes["templatetypecode"].ToString() : string.Empty,
                                                       IsPersonal = be.Attributes.Contains("ispersonal") && be.Attributes["ispersonal"] != null ? Convert.ToBoolean(be.Attributes["ispersonal"].ToString()) : false,
                                                   }).ToList<TemplateDetails>();

                        }
                        else
                        {
                            return null;                   

                        }
                    }    

    am able to bind the data to a grid it's working fine

    but am binding the all the template information

    For this  i have more entity called new-Emailmapping

    MY SQL query

    select Title,description,IsPersonal,templatetypecode from Template inner join  new_emailtemplatemapping

    if it's match

    records only has disply

    i tried to use linked query but it's not working

    can you please quide me on this

    on new_emailtemplatemapping.new_EmailTemplateId=Template.TemplateId

     


    Rammohan

    Wednesday, March 26, 2014 12:54 PM