Answered by:
List to Contacts

Question
-
I want to create a report that Links the List to the Contact table. I can not find the fields that links these two tables.
I have this difficulty from time to time does there happen to exist some document that includes what the specific fields links are.
Thank youTuesday, March 31, 2009 12:52 AM
Answers
-
There's a comprehensive diagram, but I find it very difficult to use in practice: http://www.microsoft.com/downloads/details.aspx?FamilyId=B73912E8-861E-43AE-97B4-72B3E809F287&displaylang=enAlso, there is a tool in the SDK (it's a sample that can be compiled in a tool that generates Visio diagrams from CRM 4.0 metadata) that allows you to create your own diagrams.But the way I get what I need is usually through SQL relationships: If you look at the ListBase table using SQL Management Studio, you see that there is a relationship to ListMemberBase on ListId. ListMemberBase has two fields that give out a clue: EntityId and EntityType.The link between list and contact is therefore:
ListMemberBase INNER JOIN ListBase ON ListMemberBase.ListId = ListBase.ListId INNER JOINContactBase ON ListMemberBase.EntityId = ContactBase.ContactId WHERE dbo.ListMemberBase.EntityType = 2
- Proposed as answer by Alberto Gemin - Duplicate Profile Tuesday, March 31, 2009 2:27 AM
- Marked as answer by darrenliuMicrosoft employee, Moderator Tuesday, March 31, 2009 2:42 AM
Tuesday, March 31, 2009 2:25 AM
All replies
-
There's a comprehensive diagram, but I find it very difficult to use in practice: http://www.microsoft.com/downloads/details.aspx?FamilyId=B73912E8-861E-43AE-97B4-72B3E809F287&displaylang=enAlso, there is a tool in the SDK (it's a sample that can be compiled in a tool that generates Visio diagrams from CRM 4.0 metadata) that allows you to create your own diagrams.But the way I get what I need is usually through SQL relationships: If you look at the ListBase table using SQL Management Studio, you see that there is a relationship to ListMemberBase on ListId. ListMemberBase has two fields that give out a clue: EntityId and EntityType.The link between list and contact is therefore:
ListMemberBase INNER JOIN ListBase ON ListMemberBase.ListId = ListBase.ListId INNER JOINContactBase ON ListMemberBase.EntityId = ContactBase.ContactId WHERE dbo.ListMemberBase.EntityType = 2
- Proposed as answer by Alberto Gemin - Duplicate Profile Tuesday, March 31, 2009 2:27 AM
- Marked as answer by darrenliuMicrosoft employee, Moderator Tuesday, March 31, 2009 2:42 AM
Tuesday, March 31, 2009 2:25 AM -
Thank you that is just the information I needed.
I also find the Logical Database Diagrams helpful, to a limited degree. It is when I need to know the specific fields the table links on that it does not help.
Is the took in SDK helpful in indicating the fields that link? If so what is its name, how do I run it?
Thank youTuesday, March 31, 2009 11:39 AM