locked
Getting entity parameters by id RRS feed

  • Question

  • Hello

    How to get entity parameters having its id? I mean, for example, accounts name, address, etc. I have object's id:

    Guid regardingobjectid = new Guid(context.OutputParameters["id"].ToString());

    How to obtain the rest of parameters from CRM database?

    Thank you!

    Sunday, June 9, 2013 2:03 PM

Answers

  • Hello,

    If you captured the guid for an invoice product then using an early binding you could access all of the attributes:

    using (var crm = new XrmServiceContext(service)) { var InvoiceProduct = crm.InvoiceDetailSet.Where(c => c.InvoiceDetailId == regardingobjectid).First(); var overridden = InvoiceProduct.IsPriceOverridden;

    }

    For more detailed information on how to use early binding and accessing the entity attributes have a look at this link.



    My Weblog | My Website

    Sunday, June 9, 2013 3:29 PM
    Moderator
  • There is no difference about the entities. Remember that if you capture the regardingobjectid from a party list, then it would be an activity party id not the activity id. You could access the main activity's id through the activity party table.


    My Weblog | My Website

    Sunday, June 9, 2013 3:50 PM
    Moderator

All replies

  • Hello,

    If you captured the guid for an invoice product then using an early binding you could access all of the attributes:

    using (var crm = new XrmServiceContext(service)) { var InvoiceProduct = crm.InvoiceDetailSet.Where(c => c.InvoiceDetailId == regardingobjectid).First(); var overridden = InvoiceProduct.IsPriceOverridden;

    }

    For more detailed information on how to use early binding and accessing the entity attributes have a look at this link.



    My Weblog | My Website

    Sunday, June 9, 2013 3:29 PM
    Moderator
  • Hello,

    Thanks for your reply. The guid I captured is for Activity. Can I get Activities parameters (string) the same way you described?

    Sunday, June 9, 2013 3:46 PM
  • There is no difference about the entities. Remember that if you capture the regardingobjectid from a party list, then it would be an activity party id not the activity id. You could access the main activity's id through the activity party table.


    My Weblog | My Website

    Sunday, June 9, 2013 3:50 PM
    Moderator