Posts

Showing posts from August, 2013

CRM 2011 Linq Retrieve Many to Many N:N Records

Hiya, As you all know, you can use Query Expressions or FetchXML to retrieve N:N records. Good news, we can also use LINQ if you wish to. Let's say we have a portal account (for website login) that has N:N to organisation and we want to grab all portal accounts for a given organisation (in my case I have early bound entities): Easy? :) HTH, Andreas

CRM 2011 Early Bound Entities Serialization / Deserialization

Hi all, Just want to tell my experience regarding this topic - maybe it will save your time. Crmsvcutil gives you generated entities file which can be a time saver. This is all good until you want to use those entities on client side (in my case I want to bring them to my knockout JS functionality combined with AJAX and web services to provide better user experience) Serialization = works fine (when I retrieve the records). The trick is to use JSON .NET  , and with the help of Partial class you can extend the generated entity class from crmsvcutil. To get all properties serialized you need to use the [JsonObject(MemberSerialization.OptOut)] attribute on that partial class as well. Deserialization  = The problem appears when you try to deserialize (when I try to save the records). The AttributeCollection class becomes the culprit in this, complaining that it Cannot create and populate list type of AttributeCollection . Looking at the JSON Stringify ajax data that get passed