[SOLVED] Accessing User Defined Fields in BCM Database part 1

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)
 
E

edumas

Accessing User Defined Fields in BCM Database part 2

(continued from part 1)

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.
 

Squire4Hire

Member
Outlook version
Outlook 2010 64 bit
Email Account
POP3
Excellent post! This helped a heap in getting myself connected between the SQL Server and MS Access 2010.

I did however run into a problem with the CAST statement in the Access query when it came to a currency datatype. A CStr() worked fine in converting the OLE Object to plain text but it's throwing an error when attempting to use a CCur() or CDbl() for the IndexField applicable to a BCM currency datatype.

Do you have any suggestions for this?
 

Squire4Hire

Member
Outlook version
Outlook 2010 64 bit
Email Account
POP3
I have discovered the pass-through query! This allows a user, after setting up a DNS connection to the SQL Server, to connect directly to the BCM tables and pass more robust SQL Commands without having the JET Engine try to process it for you. Commands like CAST() and CONVERT are then able to change the OLE Objects into readable data - such as CAST(dbo.ContactIMAPIView.UserField as smallmoney).
 

tlassner

Senior Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
Does anyone know how to cast the YesNo "Datatype"? Would be heplful for Access. I have to use access because i just prepare standard queries and our back-office has the task to cutomize it/ set the conditions/criteria.

Additional: think its 16-bit boolean
 

run404

New Member
Outlook version
Outlook 2010 32 bit
Email Account
POP3
actually i had the same trouble, i working on timeshare attorney business and the database doesnt connect i dont know why , tnx for share anyway
 

Tobias Koch

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
hello everyone, luckily I was able to get most things regarding BCM Userfields even acquire. For integration to our ERP system (A View that proviedes date for our ERP). Use this integration is to automatically generate offers. Now, however, we come to the limit of 300 Userfields. Does anyone know if you can put up this border?
 

ISARALF

New Member
Outlook version
Outlook 2010 64 bit
Email Account
POP3
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)
[SOLVED] - Accessing User Defined Fields in BCM Database part 1
 
Thread starter Similar threads Forum Replies Date
E Accessing User Defined Fields in BCM Database part 2 BCM (Business Contact Manager) 0
M Mails get deleted accessing a user mailbox with a different user Using Outlook 2
T Outlook closes unexpectedly upon accessing another user's calendar Using Outlook 1
RBLampert Accessing Outlook accounts from multiple computers Using Outlook 8
E Accessing shared outlook folder doesn't work since switch to new outlook/excel Outlook VBA and Custom Forms 11
J Accessing calendar items for Resource Mailboxes Outlook VBA and Custom Forms 2
S Outlook [Online - Office365] perfomance is getting affected when accessing the mails using Redemptio Using Outlook 1
J Accessing Hotmail accounts with Outlook 2016 Using Outlook 3
n2b Accessing Plain Text Draft Without Outlook Using Outlook 3
G Issues with accessing Outlook Contact Picture with VBA Outlook VBA and Custom Forms 4
M Accessing ExpiryTime property Outlook VBA and Custom Forms 1
M Accessing BCM with Excel / Running Reports BCM (Business Contact Manager) 1
C Problem accessing events for folder "username" Server Threw Exception Calendar Printing Assistant 1
P accessing custom task pane with Outlook ActiveInspector Using Outlook 1
mikecox Accessing Outlook on my Win7 desktop from Win8 laptop Using Outlook 1
A "Unable to display the folder" error when accessing Group mailbox Using Outlook 0
Commodore Accessing mail from multiple devices Using Outlook 1
S Programmatically accessing Outlook Calendar data Using Outlook 1
K trying to sync my samsung galaxy to my outlook 2010 calender. it says execution privilege prevents me from accessing outlook Using Outlook 1
P time delay between accessing Outlook file folders, up 20+ second delay Using Outlook 1
S Accessing source information Using Outlook 1
J After Window update of 12/15/2010, outlook 2007 gives error (0x800CCC18) when accessing gmail using Using Outlook 6
S Outlook 2010 freezes and not responding when accessing, moving or deleting files Using Outlook 2
N Problems accessing network files via OWA Using Outlook 5
N Shared Calendar in Public folder hangs when accessing from Outlook 2010 Exchange Server Administration 2
X Accessing a shared email folder - How? Exchange Server Administration 1
H Accessing a backup Using Outlook 3
J Problems accessing console of Exchange 2010 on Windows Server 2008 R2 Please help me Exchange Server Administration 4
S Accessing emails in a closed account Using Outlook 1
E Users get login prompt in Outlook 2007 when accessing Exchange Server 2007 Using Outlook 2
H accessing shared calendar in outlook 2007 Using Outlook 3
A BCM-Problem Accessing Database Using Outlook 1
K Outlook 2010 now freezes while accessing Gmail Using Outlook 3
S Accessing items in incoming emails. Using Outlook 1
N Outlook 7 crashing when accessing Tasks Using Outlook 2
D 403 Error in IIS when accessing a non-SSL page Using Outlook 2
R accessing owa externally and having a cas array internally Exchange Server Administration 9
L Not receiving all incoming mail when 2 computers are accessing 1 email address Using Outlook 1
O Accessing OST file which was created through Windows Outlook Connector Using Outlook 2
J Restriction on accessing hyperlinks contained in email. Using Outlook 2
C Accessing web addresses included in emails Using Outlook 1
J Accessing email from remote device. Using Outlook 2
R Program accessing .PST files Using Outlook 2
G Outlook 2010 freezes when accessing shared calendars Using Outlook 1
B Accessing outlook e-mail on a crashed desk top. Using Outlook 1
H Accessing data in Outlook\archive.pst Using Outlook 2
S Accessing Calender information post migration from Exchange 2003 to Exchange 2020 using Outlook2003 client. Exchange Server Administration 4
P Accessing Microsoft outlook on a different computer Using Outlook 1
S Quick access button for accessing a Template (.oft file) in v.2010 or 2007? Using Outlook 5
A Accessing shared calendar that is NOT DEFAULT calendar. Using Outlook 6
Similar threads


















































Top