Home | Contact Us

Powered by Blogger

Tuesday, March 06, 2007

One-to-Many Relationships

Creating one-to-many relationship in Microsoft CRM can usually be accomplished through standard configuration using the tools included in the product. However, relationships between two system entities not previously created by the system cannot be added using the tools. Instead, a custom attribute must be added to the entity via the Export / Import XML customization file.

The following steps describe the process for creating a one-to-many relationship via custom attribute:

  1. Export the customizations for the entity to be on the “child” side of the one-to-many relationship
  2. Add a new attribute with a physical name describing the primary key of the “parent” entity
  3. Set the element IsCustomField equal to 1
  4. Set the element ReferencedEntityObjectTypeCode to the object type code of the “parent” entity

The following is an example of adding an attribute to a “child” entity where the “parent” entity is account:

<attribute PhysicalName="New_AccountId">
<Type>lookup</Type>
<ValidForCreateApi>1</ValidForCreateApi>
<ValidForUpdateApi>1</ValidForUpdateApi>
<ValidForReadApi>1</ValidForReadApi>
<IsCustomField>1</IsCustomField>
<ReferencedEntityObjectTypeCode>1</ReferencedEntityObjectTypeCode>
<DisplayMask>ValidForAdvancedFind|ValidForForm|ValidForGrid</DisplayMask>
<Description />
</attribute>

Labels: ,

Copyright © 2007 AdvantageWorks Software Group, LLC. All rights reserved.