Custom Fields Database Modeling

Discussão Geral Custom Fields Database Modeling

  • donderdag 22 maart 2012 14:01
     
     

    Hi to every body

    How MS dynamic crm models the custome fields in database, for example programmer may be add additional fields to the lead entity

    how these fields adds to DB, is it add to another table i.e EAV model or it alter the table?

    I wish my question is clear :)

    Thanks.

Alle reacties

  • donderdag 22 maart 2012 14:10
     
     

    hi

     Generally for  Every  Entity Crm creates two  tables <EntityName>Base & <EntityName>Extension

      Eg: ContactBase and ContactExtension

    Extension has all custom attributes ie. additional fields

    Crm also create a FilteredView the name  <EntityName>FilteredView

    this has complete view of crm entity data

    hth

    dkay

    if the response answered your question, please take a minute and mark the response as an answer.

  • donderdag 22 maart 2012 14:37
     
     

    hi

     Generally for  Every  Entity Crm creates two  tables <EntityName>Base & <EntityName>Extension

      Eg: ContactBase and ContactExtension

    Extension has all custom attributes ie. additional fields

    Crm also create a FilteredView the name  <EntityName>FilteredView

    this has complete view of crm entity data

    hth

    dkay

    if the response answered your question, please take a minute and mark the response as an answer.

    Thanks, can you explain what are columns to extention table?
  • donderdag 22 maart 2012 14:55
     
     

    Any custom attributes added to the entity  gets added to the Extension table

    this is applicable for system entity and custom entity

    for example

      if we add a Custom Attribute to a Contact Entity say new_IsMarried boolean

    then CRM creates an additional column in Extension table and hold the data

    hope it helps

    dkay

     --------------------------------------------------------------------------------
     If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".

  • donderdag 22 maart 2012 20:58
     
     

    Hi

    Did this help?

    Please make sure to mark as answer to the response that helped you get through. This will help others with similar problem identify the answer and also close this thread as resolved.

    Thanks

    Dkay

  • donderdag 22 maart 2012 22:35
     
     

    You should create all custom fields through the CRM UI and not create them through the database. Unlinke some applications the CRM database is not somewher to be ALTER, UPDATE or CREATE SQL commands.

    If your looking to read the from these fields that is fine. As CRM Developer mentioned those fields will be in a table called <entityname>ExtensionBase as well included in the Fitlered views with some exceptions like the activity entities in 2011, which stored the custom fields in the Base tables like PhoneCallBase.

    Heres a quick videos on adding custom fields in CRM. Add Custom Fields in CRM

  • zaterdag 24 maart 2012 14:05
     
     

    OK Thanks you have said "Any custom attributes added to Extension table" so the IsMarried will be added to Extention table

    1- Are the type Is_Married in extention table is bool or varchare as other systems?.

    2- Why it's not added to original table "Contact"?

    Thanks.

    Any custom attributes added to the entity  gets added to the Extension table

    this is applicable for system entity and custom entity

    for example

      if we add a Custom Attribute to a Contact Entity say new_IsMarried boolean

    then CRM creates an additional column in Extension table and hold the data

    hope it helps

    dkay

     --------------------------------------------------------------------------------
     If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".


    • Bewerkt door Eng.Bassam zaterdag 24 maart 2012 14:08
    •  
  • maandag 30 april 2012 18:13
     
     

    1. The Data Type will depend on what type of attribute you are creating. In the case of a Bool Yes/No field it will be created as an integer field on the ContactExtensionBase table. The varchar value associated with those integers are stored in StringMapBase table.

    2. Contact is a view and not a table. The native out of the box fields for contacts can be found in the ContactBase table while custom ones you create will be stored in ContactExtensionBase. The contact view joins these two tables together.

    If you are trying to pull this information from CRM you should use the FilterdContact or Contact views as they will take care of all of the joins between the base, extensionbase, stringmap and other varios tables for you. The filteredcontact view will limit the records to only records the user has access to, while the contact view will show all of the contact records regardless of if the user has rights to see them.

    You should not create fields in the CRM database directly. It is not practical and extreemly dangerous to try and alter your CRM database in this manner.

    If you want to programatically create fields you can do it through the MetaDataService. There is sample code in the SDK that shows how to do this (sdk/samplecode/cs/metadata/attributes/workwithattributes.cs or sdk/samplecode/vb/metadata/attributes/workwithattributes.vb). You can download the SDK from http://www.microsoft.com/en-us/download/details.aspx?id=24004 .