CRM Parent Account to Outlook Company Name sync

esandstrand
Member Posts: 2
Hi everyone,
This is my first post here, so hopefully it'll be appropriate and useful.
One of the things I quickly noticed with Dynamics CRM, was that when I used the Outlook client the Parent Account field did not sync with Company Name.
I looked around a bit on the web and found a macro script that unfortunately caused an error. After much digging and trial (I am not a programmer), I understood how that the "type mismatch" error was caused.
A few mods to the script which I found here:
http://www.workopia.com/howto/DisplayPa ... ctForm.htm.
Resulted in this final one:
Sub SyncCRMCompanyName()
Dim objApp As Application
Dim objNS As NameSpace
Dim objContacts As MAPIFolder
Dim colItems As Items
Dim objContact As ContactItem
Dim strParentAcct As String
Dim i As Integer
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objContacts = objNS.GetDefaultFolder(olFolderContacts)
i = 0
Set colItems = objContacts.Items
For Each objContact In colItems
strParentAcct = ""
If objContact.CompanyName = "" Then
If objContact.UserProperties.Count > 0 Then
strParentAcct = objContact.UserProperties.Item("Parent Account")
If strParentAcct <> "" Or objContact.CompanyName <> strParentAcct Then
Rem Answer = MsgBox(strParentAcct, vbOKCancel)
objContact.CompanyName = strParentAcct
objContact.Save
i = i + 1
End If
End If
End If
Next
MsgBox ("All done: " & i & " records updated")
End Sub
Runs like a charm and puts Parent Account into Company Name!
Hope it works for you!
Thx,
-e
This is my first post here, so hopefully it'll be appropriate and useful.
One of the things I quickly noticed with Dynamics CRM, was that when I used the Outlook client the Parent Account field did not sync with Company Name.
I looked around a bit on the web and found a macro script that unfortunately caused an error. After much digging and trial (I am not a programmer), I understood how that the "type mismatch" error was caused.
A few mods to the script which I found here:
http://www.workopia.com/howto/DisplayPa ... ctForm.htm.
Resulted in this final one:
Sub SyncCRMCompanyName()
Dim objApp As Application
Dim objNS As NameSpace
Dim objContacts As MAPIFolder
Dim colItems As Items
Dim objContact As ContactItem
Dim strParentAcct As String
Dim i As Integer
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objContacts = objNS.GetDefaultFolder(olFolderContacts)
i = 0
Set colItems = objContacts.Items
For Each objContact In colItems
strParentAcct = ""
If objContact.CompanyName = "" Then
If objContact.UserProperties.Count > 0 Then
strParentAcct = objContact.UserProperties.Item("Parent Account")
If strParentAcct <> "" Or objContact.CompanyName <> strParentAcct Then
Rem Answer = MsgBox(strParentAcct, vbOKCancel)
objContact.CompanyName = strParentAcct
objContact.Save
i = i + 1
End If
End If
End If
Next
MsgBox ("All done: " & i & " records updated")
End Sub
Runs like a charm and puts Parent Account into Company Name!
Hope it works for you!
Thx,
-e
Check out Relationship Charts for Microsoft CRM!
http://salescentric.com/products/relati ... harts.html
http://salescentric.com/products/relati ... harts.html
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions