W
whkratz
In the 3/23/2007 post titled "Linking Tasks to Contacts",
So here's a new version of the BCM Nexus code that takes care of Lon's
request (I think). The code will link your Tasks or Appointments created in
BCM back to the parent Business Contact or Account (just as before), and it
will now insert a field in the Task or Appointment that contains the Business
Phone Number of the associated Contact or Account. After you have created at
least one Task (or Appointment) with the code in place, you can create new
views of your Tasks or Appointments that include the BCMPhone field. Just
use the Field Chooser to grab the BCMPhone field which should be listed under
User Defined Fields in Folder.
Insert the code below into your ThisOutlookSession (or replace your current
BCM Nexus vba if you already are using it from the earlier posts). Remember
to watch out for lines that might have been wrapped by this board's mail
program.
Enjoy.
Regards.....Bill Kratz
Here's the vba code:
Option Explicit
Private WithEvents olInspectors As Outlook.Inspectors
Private Sub Application_Startup()
Dim olApp As New Outlook.Application
Set olInspectors = olApp.Inspectors
End Sub
Private Sub olInspectors_NewInspector(ByVal pInspector As Outlook.Inspector)
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objItem As Object
Dim strID As String
Dim bcmContact As Outlook.ContactItem
Dim strBCMPhone As String
Dim BCMPhone As UserProperty
Set olApp = CreateObject("Outlook.Application")
Set objNS = olApp.GetNamespace("MAPI")
Set objItem = pInspector.CurrentItem
If objItem.Class = olTask Or olAppointment Then
If Not objItem.UserProperties("TemporaryParentEntryId") Is Nothing
Then
strID = objItem.UserProperties("TemporaryParentEntryId")
Set bcmContact = objNS.GetItemFromID(strID)
objItem.Links.Add bcmContact
strBCMPhone = bcmContact.BusinessTelephoneNumber
Set BCMPhone = objItem.UserProperties.Add("BCMPhone", olText)
BCMPhone.Value = strBCMPhone
End If
End If
Set bcmContact = Nothing
Set objItem = Nothing
Set objNS = Nothing
Set olApp = Nothing
End Sub
Private Sub Application_Quit()
Set olInspectors = Nothing
End Sub
Lon Orenstein said:Bill:
The request has been made multiple times in this group for a function
similar to what people are used to in ACT (and other contact managers). In
their task list, they could see not only the subject of the task, but who it
was scheduled with (linked to, which you just fixed), and their phone number
(which we're all hoping you'll do next!). That way, a person can just look
at the task list, see the task (like make a follow up call to a prospect),
see who it applies to, and dial their number without ever leaving that one
screen.
So, that's why the request for the phone number too...
Thanks,
Lon
So here's a new version of the BCM Nexus code that takes care of Lon's
request (I think). The code will link your Tasks or Appointments created in
BCM back to the parent Business Contact or Account (just as before), and it
will now insert a field in the Task or Appointment that contains the Business
Phone Number of the associated Contact or Account. After you have created at
least one Task (or Appointment) with the code in place, you can create new
views of your Tasks or Appointments that include the BCMPhone field. Just
use the Field Chooser to grab the BCMPhone field which should be listed under
User Defined Fields in Folder.
Insert the code below into your ThisOutlookSession (or replace your current
BCM Nexus vba if you already are using it from the earlier posts). Remember
to watch out for lines that might have been wrapped by this board's mail
program.
Enjoy.
Regards.....Bill Kratz
Here's the vba code:
Option Explicit
Private WithEvents olInspectors As Outlook.Inspectors
Private Sub Application_Startup()
Dim olApp As New Outlook.Application
Set olInspectors = olApp.Inspectors
End Sub
Private Sub olInspectors_NewInspector(ByVal pInspector As Outlook.Inspector)
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objItem As Object
Dim strID As String
Dim bcmContact As Outlook.ContactItem
Dim strBCMPhone As String
Dim BCMPhone As UserProperty
Set olApp = CreateObject("Outlook.Application")
Set objNS = olApp.GetNamespace("MAPI")
Set objItem = pInspector.CurrentItem
If objItem.Class = olTask Or olAppointment Then
If Not objItem.UserProperties("TemporaryParentEntryId") Is Nothing
Then
strID = objItem.UserProperties("TemporaryParentEntryId")
Set bcmContact = objNS.GetItemFromID(strID)
objItem.Links.Add bcmContact
strBCMPhone = bcmContact.BusinessTelephoneNumber
Set BCMPhone = objItem.UserProperties.Add("BCMPhone", olText)
BCMPhone.Value = strBCMPhone
End If
End If
Set bcmContact = Nothing
Set objItem = Nothing
Set objNS = Nothing
Set olApp = Nothing
End Sub
Private Sub Application_Quit()
Set olInspectors = Nothing
End Sub