Use metadata to generate entity diagrams
Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online
Visual representation of metadata can be very useful, especially when you are trying to describe the relationship between entities in the system. You can use the Metadata Diagram sample code provided for Microsoft Dynamics 365 (online & on-premises) to generate the entity relationship diagrams. You can create a simple diagram that shows a relationship for just one entity, or a complex diagram that includes dozens of related entities, including custom and system entities.
In This Topic
Relationships in entity diagrams
About the diagrams
Generate entity diagrams with the metadata diagram tool
Relationships in entity diagrams
The following example shows two new custom entities created in Microsoft Dynamics 365. The first entity represents a bank account and the second entity represents a safe deposit box. The following entity diagram was generated by using the Metadata Diagram tool. It shows the relationship between the new_bankaccount entity, the new_safedepositbox entity, and other entities in the system. The names shown are the logical entity names. Note that if there are multiple relationships between the same two entities, only one line is drawn in the diagram for simplicity.
The following table shows the one-to-many relationships where the primary entity is either bank account or safe deposit box.
Relationship schema name |
Referencing entity |
---|---|
new_bankaccount_ActivityPointers |
activitypointer |
new_bankaccount_Appointments |
appointment |
new_bankaccount_Emails |
|
new_bankaccount_Faxes |
fax |
new_bankaccount_Letters |
letter |
new_bankaccount_PhoneCalls |
phonecall |
new_bankaccount_ServiceAppointments |
serviceappointment |
new_bankaccount_Tasks |
task |
new_bankaccount_RecurringAppointmentMasters |
recurringappointmentmaster |
new_bankaccount_DuplicateMatchingRecord |
duplicaterecord |
new_bankaccount_DuplicateBaseRecord |
duplicaterecord |
new_bankaccount_Annotations |
annotation |
new_bankaccount_AsyncOperations |
asyncoperation |
new_bankaccount_UserEntityInstanceDatas |
userentityinstancedata |
new_bankaccount_ProcessSession |
processsession |
new_bankaccount_BulkDeleteFailures |
bulkdeletefailure |
new_bankaccount_PrincipalObjectAttributeAccesses |
principalobjectattributeaccess |
new_new_bankaccount_new_safedepositbox |
new_safedepositbox |
new_safedepositbox_ActivityPointers |
activitypointer |
new_safedepositbox_Appointments |
appointment |
new_safedepositbox_Emails |
|
new_safedepositbox_Faxes |
fax |
new_safedepositbox_Letters |
letter |
new_safedepositbox_PhoneCalls |
phonecall |
new_safedepositbox_ServiceAppointments |
serviceappointment |
new_safedepositbox_Tasks |
task |
new_safedepositbox_RecurringAppointmentMasters |
recurringappointmentmaster |
new_safedepositbox_DuplicateMatchingRecord |
duplicaterecord |
new_safedepositbox_DuplicateBaseRecord |
duplicaterecord |
new_safedepositbox_Annotations |
annotation |
new_safedepositbox_AsyncOperations |
asyncoperation |
new_safedepositbox_UserEntityInstanceDatas |
userentityinstancedata |
new_safedepositbox_ProcessSession |
processsession |
new_safedepositbox_BulkDeleteFailures |
bulkdeletefailure |
new_safedepositbox_PrincipalObjectAttributeAccesses |
principalobjectattributeaccess |
The following table shows the many-to-one relationships where the primary entity is either bank account or safe deposit box.
Relationship schema name |
Referenced entity |
---|---|
lk_new_bankaccount_createdby |
systemuser |
lk_new_bankaccount_createdonbehalfby |
systemuser |
lk_new_bankaccount_modifiedby |
systemuser |
lk_new_bankaccount_modifiedonbehalfby |
systemuser |
user_new_bankaccount |
systemuser |
team_new_bankaccount |
team |
owner_new_bankaccount |
owner |
business_unit_new_bankaccount |
businessunit |
new_account_new_bankaccount |
account |
lk_new_safedepositbox_createdby |
systemuser |
lk_new_safedepositbox_createdonbehalfby |
systemuser |
lk_new_safedepositbox_modifiedby |
systemuser |
lk_new_safedepositbox_modifiedonbehalfby |
systemuser |
user_new_safedepositbox |
systemuser |
team_new_safedepositbox |
team |
owner_new_safedepositbox |
owner |
business_unit_new_safedepositbox |
businessunit |
new_new_bankaccount_new_safedepositbox |
new_bankaccount |
The account entity that is shown on the diagram represents a bank customer. As a bank customer, you can open several bank accounts, such as checking and savings accounts, and also several safe deposit boxes. This is an example of a many-to-one relationship type between a bank account and a customer, and a safe deposit box and a customer. You can associate multiple activities, such as tasks, emails, and appointments with a bank account. To provide additional information about a bank account or a safe deposit box, you can use notes and attachments.
About the diagrams
You can find the diagrams for many system entities in the SDK documentation, in the topics that describe the entity capabilities. In each box in the diagram, the first line in bold text is the name of the entity. Subsequent lines contain the names of the attributes used to define the relationships for that entity. The tool does not generate lines showing the relationships to the following entities: organization, business unit, and user (systemuser). This is done to simplify the diagram. Color coding is used to indicate the owner relationship for each entity. The following diagram describes the color coding:
Generate entity diagrams with the metadata diagram tool
To use the sample code that will programmatically generate Microsoft Office Visio metadata diagrams, build and execute the one of these solutions found in the SDK package: SDK\SampleCode\CS\Metadata\Diagram. The folder contains a Readme file with instructions for its use. The code sample is a stand-alone console application that creates an entity relationship diagram. The program requiresMicrosoft Office Visio.
You can run the program at the command prompt. Simply list the entities you wish to include in the diagram as command-line arguments. Other entities may be included in your diagram as needed to show all the relationships for each entity you have requested. To generate a diagram that shows the relationships for the new_bankaccount and new_safedepositbox entities, use the following command:
MetadataDiagramConsole.exe new_bankaccount new_safedepositbox
The name of the generated Visio file is new_bankaccount.vsd.
Note
The tool uses the name of the first entity on the command line as the name of the Visio file. If you execute the following two commands, the second command overwrites the diagram generated by the first. This is because the Visio files have the same name –”new_bankaccount.vsd”:
MetadataDiagramConsole.exe new_bankaccount
MetadataDiagramConsole.exe new_bankaccount new_safedepositbox
To avoid overwriting a generated diagram file, you have to rename the first file before you run the second command.
See Also
Introduction to entities in Microsoft Dynamics 365
Use the Organization service with Dynamics 365 metadata
Key to entity diagrams
CRM 2015 Entity Relationship Diagrams
Microsoft Dynamics 365
© 2016 Microsoft. All rights reserved. Copyright