Uwe 的个人资料CRM space日志 工具 帮助

日志


2月16日

Use GeoNames, Microsoft Virtual Earth and Flickr with CRM 4.0

The last days I tried to integrate GeoNames, Microsoft Virtual Earth and Flickr in my CRM 4.0 VPC.

This article describes how you:

  • get the city name or zip/postal code from GeoNames when you enter the zip/postal code or city name (auto complete function, with Microsoft Virtual Earth support)
  • show the current account address in Microsoft Virtual Earth and calculate the route to this address from your user address
  • display some geo-tagged photos from Flickr which are taken near the account address and have the account name in the name or description

This solution is only a demonstration. If you use the entire solution or parts of it you must comply with the terms and conditions of the used 3rd party suppliers. The coding and the error handling is not always optimal and some scenarios could be improved.

1. Necessary preparations for all scenarios

a. Add the two existing attributes “Address 1: Latitude” and “Address 1: Longitude” to the account form. Add a new tab called “Virtual Earth / Flickr” to the form.

Account_Form 01

b. Add two new sections (“Virtual Earth” and “Flickr”) and iframes (“IFRAME_VirtualEarthFrame” and “IFRAME_FlickrFrame”) to the tab “Virtual Earth / Flickr”. The urls of the two iframes are mapped to two local .net web pages. You must change the url of those local .net web pages, if you install the pages on a server. If you run the pages from visual studio (debugging with ASP.NET Development Server) you must probably change the port number (currently 2047).

Account_Form 02

Virtual earth iframe 01

Virtual earth iframe 02

Flickr iframe 01

Flickr iframe 02

c. Add the content of the file “Account.OnLoad.js” to the OnLoad-Event of the account form.

The onchange events of the fields “City” and “ZIP/Postal Code” are mapped to a function, which calls a local .net web service. This web service queries the web service of geonames.org with the value of city or zip/postal code to get the appropriate cities. You must change the url of the local .net web service, if you install this web service on a server. If you run the web service from visual studio (debugging with ASP.NET Development Server) you must probably change the port number (currently 1737).

If the result from geonames.org contains more than one city, a local .net web page is displayed as popup. You must change the url of this local .net web page, if you install this page on a server. If you run the page from visual studio (debugging with ASP.NET Development Server) you must probably change the port number (currently 2047).

The onchange events of the fields “Address 1: Latitude” and “Address 1: Longitude” are mapped to a function, which reloads the flickr iframe. For this iframe a local .net web page exists, which loads the photos from Flickr. You must change the url of this local .net web page, if you install this page on a server. If you run the page from visual studio (debugging with ASP.NET Development Server) you must probably change the port number (currently 2047).

d. Save and publish all changes of the account entity.

2. Auto complete function for city name or zip/postal code with GeoNames

If you enter a city name or a zip/postal code a query of the web service of geonames.org is made. If no match is found, a message is displayed. If exactly one city is found, the values of this match (city name, zip/postal code, state, country, latitude, longitude) are filled in the crm fields. If more than one city is found, a .net web page with a dropdown list is displayed. On this page you can select the different cities and display those cities on a Microsoft Virtual Earth map.

Auto complete 01

Auto complete 02

Auto complete 03

3. Use of Microsoft Virtual Earth

The Microsoft Virtual Earth map is displayed on a local .net web page within a crm iframe. You can locate the current account address on this map and calculate a route from your user address (the values are changeable) to the account address. If you change one of the following fields, these values are filled in the according fields on the .net web page. The fields are: “Street 1”, “City”, “State”, “ZIP/Postal Code” and “Country”. The address of the current user is determined at the page load event of the .net web page and can be changed by the user.

Virtual earth 01

Virtual earth 02

4. Use of Flickr

Photos from Flickr are displayed on a local .net web page within a crm iframe. If you change one of the following fields, the .net web page is reloaded with those values as parameters. The fields are: “Address 1: Latitude” and “Address 1: Longitude”. The web page queries the flickr web service to get at most 100 geo-tagged photos taken near the account address latitude and longitude and with the account name in name or description. Keep in mind that the latitude and longitude values are from Geonames and these values mark the center of the city and not the street of the account (needs to be improved).

Flickr 01

If you have any questions or suggestions please don't hesitate to contact me.

Here you can download the entire solution.

评论 (1)

请稍候...
很抱歉,您输入的评论太长。请缩短您的评论。
您没有输入任何内容,请重试。
很抱歉,我们当前无法添加您的评论。请稍后重试。
若要添加评论,需要您的家长授予您相应权限。请求权限
您的家长禁用了评论功能。
很抱歉,我们当前无法删除您的评论。请稍后重试。
您已超过了一天之内允许提供的评论数上限。请在 24 小时后重试。
因为我们的系统表明您可能在向其他用户提供垃圾评论,您的帐户已禁用了评论功能。如果您认为我们错误地禁用了您的帐户,请联系 Windows Live 支持部门
完成下面的安全检查,您提供评论的过程才能完成。
您在安全检查中键入的字符必须与图片或音频中的字符一致。

若要添加评论,请使用您的 Windows Live ID 登录(如果您使用过 Hotmail、Messenger 或 Xbox LIVE,您就拥有 Windows Live ID)。登录


还没有 Windows Live ID 吗?请注册

First of all, thanks Uwe for sharing this, great way of geolocalization integration. Can I ask your help as we've an issue in this installation as every single part seems to work (Ws, main site, etc..) but when the main site is connecting we've an authentication issue(401 Unauthorized). In the crm trace the logs are showing this : UTH: MultipleOrganizationSoapHeaderAuthenticationProvider reject request http://mscrm:5555/MSCrmServices/2007/CrmService.asmx because Microsoft.Crm.CrmConfigObjectNotFoundException: Organization With Name = MicrosoftCRM Does Not Exist.
We've already changed the orgname in the virtualearthframe.aspx.cs file but that do not work. Can you help us ? Thanks a lot
10 月 28 日

引用通告 (4)

此日志的引用通告 URL 是:
http://uwekaessner.spaces.live.com/blog/cns!21916E8556D908E!208.trak
引用此项的网络日志