Entity attribute size for CRM Online RRS feed

  • Question

  • Hi,
     I am using SDK.Metadata.RetrieveAllEntities in my JavaScript when on load of an entity form to retrive the metadata for all the entities in my org. I want to have the sum of the size of attributes of the entity.

    For example, the CRM attribute of type "Option Set" is stored as "Int" SQL server datatype and the size of the size of this datatype is 4 bytes. I want the sum of the size of the datatype of attributes of the entity in JavaScript for CRM Online org. 
    Is there any way to achieve this?

    Wednesday, May 13, 2015 12:19 PM

All replies

  • For most attribute types, you'll need to know how much space they take up (e.g. that an Option Set is 4 bytes), which you can really only do by investigation in SQL of an OnPremise implementation. Text fields have a specific maximum length that you can get from the AttributeMetadata (though note that all strings are stored as Unicode, so 2 bytes per character).

    Some other things to note:

    • The AttributeMetadata includes virtual columns (e.g. for the name of lookup attributes), which you should exclude
    • PartyList attributes are stored in the ActivityParty entity, and can have any number of values, so can't be simply summed
    • Almost all attributes are nullable, and strings are nvarchars, so any calculation is at best the maximum possible space, rather than the amount any individual record takes up  

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

    Thursday, May 14, 2015 10:06 AM
  • Thanks David. Do you have the list of what all attributes do I need to exclude from the calculation?
    Thursday, May 28, 2015 11:48 AM