Article by edumas, first posted in our BCM forum
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:
- FieldGUID associated with user-specified FieldName
- DataType associated with user-specified FieldName
- DataTypeName for the DataType (DataType is same as DataTypeID)
- UserFieldIndex associated with FieldGUID
- EntityType associated with UserFieldIndex
- EntityTypeName for the EntityType (EntityType is same as EntityTypeID)
- SQL Database View of the EntityType which also contains the UDFs
- SQL Database Views containing information related to the EntityType View
- Create SQL Query
- Including Joins of related views
- 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
Step 6: Find the EntityTypeName for the EntityType (EntityType is same as EntityTypeID)*
This is located in the SQL Database Table called EntityTypesTable
* Some fields may exist in multiple EntityTypes so you’ll need to refer back to step 4 to find the Field associated with the EntityType of interest.
Step 7: Find the SQL Database View of the EntityType which also contains the UDFs
The SQL Database Views that contain “IMAPIView” in the title are the views that contain all the UDFs. In this example, we want to use the OpportunityIMAPIView.
Step 8: Find the SQL Database Views containing information related to the EntityType View
Since the OpportunityIMAPIView only contains the UDFs, we’ll need to also reference the Opportunity View that contains the core fields as well as the Contact View that contains the core fields. In this example, we’ll need the OpportunityFullView and the ContactFullView.
Step 9: Create the SQL Query (including Joins of related Views)
Using Query Designer in SQL Server Management Studio, the final Query looks like this:
SELECT
OpportunityFullView.OpportunityName,
ContactFullView.FullName,
CAST(OpportunityIMAPIView.UserField7 AS nvarchar(500)) AS Test_UDF
FROM
OpportunityIMAPIView
INNER JOIN
OpportunityFullView ON OpportunityIMAPIView.ContactServiceID = OpportunityFullView.ContactServiceID
INNER JOIN
ContactFullView ON OpportunityFullView.ParentEntryID = ContactFullView.EntryGUID
A few final key points:
1. Step 3 was how the DataType was determined for the CAST function. In this example, UserField7 was CAST as nvarchar since the DataType was “Text”. If it had been of DataType “Date Time”, we would have used CAST as datetime.
2. Finally, from Step 4, we determined from the UserFieldIndex that we wanted UserField7 from the OpportunityIMAPIView View.
Hi There,
we migrated from BCM2010 to BCM2013 - better to say we tried...
The update tool didn't work, so we deleted everything manually and installed office 2013 and BCM 2013. We also migrated all data "by hand" with some SQL scripts and nearly everything is looking good.
But we have the following problems:
- UDF are visible on the masks but the content is missing. In the database the userfield table is filled
- When we like to filter some tabs or views or matkeitng activities, the UDFs are not visibile.
I think we misses any connection of the UDFs by migrating our data, but I don't know where...
When I try with the statements above everything is looking fine...
How did you update (the failed one) ? Did you get any error messages? I think the solution will be to fix the upgrade - it sounds like the scripts are missing something.
Hi Diane,
Do you know if you are able to create a report and pull info from fields in both "Opportunities" and in "Business Contacts"?
It's been a long time since I used BCM (since it doesn't work with outlook 2016) but if BCM reports can't do it, you might be able to do it using a VBA macro in Outlook.
Another problem in BCM.
Randomly contacts are deleting without any action from the user. Several times I have to set them back from the deleted items. Does anyone have experience with that -and even better- the solution for that?
Maybe it's connected to my problems above, so that's why I leave it as a comment instead of opening a new post.
Thanks for your reply.
1) In the mean while, i've asked a friend to copy the numbers to a UDF markup as text. It's probably a floating point / SmallInt problem. Do you not experiance that problem?
2) I'm syncing the contacts with the utility in Outlook BCM. The button in Synchronising (I've the Dutch version so cannot talk you trough the menu's). The contacts are being synchronised, but the accounts aren't. I want to see the accounts also on my phone.
PS. Now i see another problem. The contacts are indeed beeing synchronised to my (Android) phone (as mentioned before). They (also) appear on My Contacts in Outlook. But they are multiplying. A lot of the contacts are multiple times mentioned and they come out of BCM. I know that they are comming form BCM because I've made a category for the contacts wich are comming from BCM (and differs from other existing contacts). So a contact appears several times in MyContacts and on my mobile. In a few days 200 contacts are 2600 contacts...
Hello Diane,
I'm reading your post with interest. Thanks for that!
I'm from the Netherlands and using BCM in outlook 2013 in a server environment. Besides a lot of problems in translations en typical differences in country (for example the adresses), the real question:
I've made a User Defined Field in Accounts to enter the Chamber of Commerce number in the Accounts "KvK-nummer", type number shortened. But when I enter- for example the number 57721149, BCM displays and saves 57721148 (Notice the last number). It does so whit a lot of numbers.
Strangely the import (from another CRM) is saved correctly.
57.721.146 turns BCM into 57.721.144
57.721.147 turns BCM into 57.721.148
57.721.148 stays 57.721.148
Do you know what the cause is, and even better, how to solve it?
Thanks,
Barry
PS besides and off topic, but maybe you know this: We already synced our business contacts with android, thats great. But how also to synchronise the accounts with android?
I have no idea why BCM is changing the numbers.
How are you syncing the contacts? If the accounts sync to outlook's contact folder, they will sync to the phone.
Hi, Diane. This page helped me a lot to learn how to find my user defined fields.
Do you have an article like this one to UPDATE my user defined field?
Here is the query I made to find my field in question:
SELECT
LastName,
CAST(ContactIMAPIView.UserField15 AS DateTime) AS [Last Activity]
FROM [MSSmallBusiness].[dbo].ContactIMAPIView
INNER JOIN
[MSSmallBusiness].[dbo].ContactFullView ON [MSSmallBusiness].[dbo].ContactIMAPIView.ContactServiceID =
[MSSmallBusiness].[dbo].ContactFullView.ContactServiceID
where email1address = 'kerry.j.preete@monsanto.com'
Now I want to change this to an update query in my Outlook VBA program.
Can you direct me to an appropriate article for showing me how to code the update?
Or if you already have a code snippet, that would help as well.
Thanks,
Rich
I definitely don't have any code samples. Did you try the regular SQL update statment - "update table set fields where fields = whatever" ?