E
edumas
I had a heck of time solving this so I thought i'd share. Thanks to k99ja04 for pointing me in the right direction. Hopefully there aren't too many errors in this write up.
Accessing User-Defined Fields in a Business Contact Manager 2010 SQL Database
In BCM, custom fields are called user-defined fields (UDF). When a UDF is created, BCM creates entries in several tables to keep track of the new UDF, stores the actual data in binary format and labels the columns UserField# - where # is a number between 1 and 300. In order to access the data stored in a UDF (e.g. for reporting purposes), a user must find the following information:
1. FieldGUID associated with user-specified FieldName
2. DataType associated with user-specified FieldName
3. DataTypeName for the DataType (DataType is same as DataTypeID)
4. UserFieldIndex associated with FieldGUID
5. EntityType associated with UserFieldIndex
6. EntityTypeName for the EntityType (EntityType is same as EntityTypeID)
7. SQL Database View of the EntityType which also contains the UDFs
8. SQL Database Views containing information related to the EntityType View
9. Create SQL Query
a. Including Joins of related views
b. Using CAST function to view UDF Binary Data
The best way to explain this process is by example. Let’s assume a UDF has been created for the Opportunity form called Test UDF and is of type Date/Time. Now let’s assume we’d like to query the database for a list of Opportunities including the Opportunity Name, Business Contact Name and Test UDF data. We’ll start by collecting the information specified above.
Step 1: Find the FieldGUID associated with Test UDF (user-specified FieldName)
This is located in the SQL Database Table called UserFieldDefinitions
Step 2: Find the DataType associated with user-specified FieldName
This is also located in the SQL Table called UserFieldDefinitions
Step 3: Find the DataTypeName for the DataType
This is located in the SQL Table called UserFieldDataTypes
Step 4: Find the UserFieldIndex associated with the FieldGUID
This is located in the SQL Database Table called EntityUserFields
Step 5: Find the EntityType associated with UserFieldIndex
This is also located in the SQL Database Table called EntityUserFields
(continued in part 2 post)
Accessing User-Defined Fields in a Business Contact Manager 2010 SQL Database
In BCM, custom fields are called user-defined fields (UDF). When a UDF is created, BCM creates entries in several tables to keep track of the new UDF, stores the actual data in binary format and labels the columns UserField# - where # is a number between 1 and 300. In order to access the data stored in a UDF (e.g. for reporting purposes), a user must find the following information:
1. FieldGUID associated with user-specified FieldName
2. DataType associated with user-specified FieldName
3. DataTypeName for the DataType (DataType is same as DataTypeID)
4. UserFieldIndex associated with FieldGUID
5. EntityType associated with UserFieldIndex
6. EntityTypeName for the EntityType (EntityType is same as EntityTypeID)
7. SQL Database View of the EntityType which also contains the UDFs
8. SQL Database Views containing information related to the EntityType View
9. Create SQL Query
a. Including Joins of related views
b. Using CAST function to view UDF Binary Data
The best way to explain this process is by example. Let’s assume a UDF has been created for the Opportunity form called Test UDF and is of type Date/Time. Now let’s assume we’d like to query the database for a list of Opportunities including the Opportunity Name, Business Contact Name and Test UDF data. We’ll start by collecting the information specified above.
Step 1: Find the FieldGUID associated with Test UDF (user-specified FieldName)
This is located in the SQL Database Table called UserFieldDefinitions
Step 2: Find the DataType associated with user-specified FieldName
This is also located in the SQL Table called UserFieldDefinitions
Step 3: Find the DataTypeName for the DataType
This is located in the SQL Table called UserFieldDataTypes
Step 4: Find the UserFieldIndex associated with the FieldGUID
This is located in the SQL Database Table called EntityUserFields
Step 5: Find the EntityType associated with UserFieldIndex
This is also located in the SQL Database Table called EntityUserFields
(continued in part 2 post)