locked
CRM 2011 Plugin - not able to retrieve list of all attributes(columns) of an entity 'x' using LINQ RRS feed

  • Question

  • Hi,

    I have LINQ query as like below:

    if(some condition) { var Column = "new_columnname"; var key = new Guid("xxxxxx.. - guid - value -...xx "); var Q1 = (from d context.CreateQuery(entity_name) where((guid)d[primary_key])== key select d).First();

    foreach(var items in Q1.Attributes)

    {

    //if I suppose to print the attributes from the record available in query Q1 -

    // It display only few columns(attributes) of that particular entity

    }

    if(Q1..Attributes.Contains(Column)) { tempbody = Q1.Attributes[Column].ToString(); } }

    Is there any other way to achieve this using linq or SQL syntax.

    Kindly Reply ASAP .


    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Monday, August 19, 2013 6:01 PM

Answers

  • you can write query expresssions to retrieve the records from ms crm 

    search on query expression in ms crm 


    ms crm

    • Marked as answer by Rk Pol Wednesday, August 21, 2013 6:57 PM
    Tuesday, August 20, 2013 7:39 AM
  • LINQ and QueryExpression will only return attributes that have a value; if an attribute is null, then it won't be included in the Entity record.

    To retrieve all attributes, I'd use a RetrieveEntityRequest to get the metadata


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    • Marked as answer by Rk Pol Wednesday, August 21, 2013 6:57 PM
    Tuesday, August 20, 2013 8:12 AM
    Moderator

All replies

  • you can write query expresssions to retrieve the records from ms crm 

    search on query expression in ms crm 


    ms crm

    • Marked as answer by Rk Pol Wednesday, August 21, 2013 6:57 PM
    Tuesday, August 20, 2013 7:39 AM
  • LINQ and QueryExpression will only return attributes that have a value; if an attribute is null, then it won't be included in the Entity record.

    To retrieve all attributes, I'd use a RetrieveEntityRequest to get the metadata


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    • Marked as answer by Rk Pol Wednesday, August 21, 2013 6:57 PM
    Tuesday, August 20, 2013 8:12 AM
    Moderator