locked
Unavailable custom entity in .net RRS feed

  • Question

  • Hi,
    I am building a custom workflow activity.
    I have a custom entity "x".
    I can't create a custom entity instance.
    I added microsoft.crm.sdk and microsoft.crm.sdktypeproxy as references.
    Why is that?
    How can i see the custom entity?
    It's urgent :s
    Thanks in advance
    Tuesday, March 31, 2009 9:31 AM

Answers

  • Attributes are never visible as properties on Dynamic Entities. The dynamic entity is simply said a dictionary containing all properties with values for the specific record.
    Example:

    DynamicEntity contact = //Retrieve Contact from CRM
    string firstname = (string)contact["firstname"];
    Lookup myLookup = (Lookup)contact["new_mylookup"];
    Thursday, April 9, 2009 12:09 PM

All replies

  • You can not instantiate custom entities using the SDK assemblies directly. (Unlike system entities like account, contact etc..)
    You'll need to work with dynamic entities to retrieve, update, delete custom entities.

    You can see an example in the tread below.

    H.
    Tuesday, March 31, 2009 12:14 PM
  • What you are using is the strongly type approach, I would recommend that you use the Dynamic Entity approach like Hassan suggested.


    Darren Liu | 刘嘉鸿 | MS CRM MVP | English Blog: http://msdynamicscrm-e.blogspot.com | Chinese Blog: http://liudarren.spaces.live.com
    Tuesday, March 31, 2009 3:12 PM
    Moderator
  • Hi, I am using dynamic entities now but I still can't see the custom attributes created. I added a lookup for account on order product entity and i can't see it. Any solution for this? Thanks
    Thursday, April 9, 2009 8:09 AM
  • Attributes are never visible as properties on Dynamic Entities. The dynamic entity is simply said a dictionary containing all properties with values for the specific record.
    Example:

    DynamicEntity contact = //Retrieve Contact from CRM
    string firstname = (string)contact["firstname"];
    Lookup myLookup = (Lookup)contact["new_mylookup"];
    Thursday, April 9, 2009 12:09 PM
  • Sabine,  if you use the Visual Studio debugger extensively, trying to figure out what a Dynamic Entity contains can be baffling. You can use a debugger visualizer to help you see inside the Dynamic Entity. Here's an example with downloadable code: http://blogs.msdn.com/ukcrm/archive/2008/07/08/creating-a-debugger-visualizer-for-dynamic-entities.aspx.
    Saturday, April 11, 2009 5:56 PM
  • Hi a1sabine8

    We created a product called XrmLinq because it's tough getting started with the Dynamics CRM SDK
    Take a look at http://www.xrmlinq.com

    It'll take away all the difficulties you're experiencing at the moment

    To give you an example, in your case creating an instance of your custom entity using:

    XrmLinq
    CustomEntityX example = new CustomEntityX();
    example.SomeProperty = "xyz";
    CrmDataAccess.Create<CustomEntityX>(example);

    CRM SDK
    DynamicEntity entity = new DynamicEntity("customentityx"); 
    PropertyCollection properties = new PropertyCollection();
    properties.Add(new StringProperty("someproperty", "xyz"));
    entity.Properties = properties;

    XrmLinq - LINQ to Dynamics CRM http://www.xrmlinq.com
    Saturday, April 11, 2009 10:09 PM