none
如何将google地图嵌入客户实体中 RRS feed

  • 问题

  • 想在客户实体中的一个标签中显示出客户的address1的位置。
    希望当地址1被onsave或onchange后,再次打开时,切换到地图标签,就能显示出位置,而不用再在地图标签里去搜索。

    能给点思路或建议吗?
    2009年7月17日 4:39

答案

  • 解决了。
    参考了几篇文章

    http://www.qiuhao.com/dispbbs.asp?BoardID=26&ID=2725
    还研究一下google地图搜索参数格式,把qiuhao上的那篇文章改了改,就行了。发觉还是google的比较好用。

    1、先在客户实体中新建一个叫地图的标签,在里面建一个节,再在节里建一个IFRame,命名为IFRAME_LocationMAP;URL指向http://ditu.google.com/
        再在客户实体中新建一个叫公司网站的标签,在里面建一个节,再在节里建一个IFRame,命名为IFRAME_Website;URL地址随便写,但必须是一个网址的格式。

    2、在常规标签中所有与地址相关的字段的onchange事件注入js代码为

    var AccountURL = crmForm.all.websiteurl.DataValue;
    if (AccountURL != null)
    {
       crmForm.all.IFRAME_Website.src=AccountURL;
    }
    var mappath=" http://ditu.google.com/maps?f=q&hl=zh-CN&q=";
    var cnty0=crmForm.all.address1_country.DataValue;
    if (cnty0 != null)
    {
         mappath=mappath+cnty0;
     }
    var city0= crmForm.all.address1_stateorprovince.DataValue;
    if (city0 != null)
    {
        mappath=mappath+"+"+city0;
    }
    var city0= crmForm.all.address1_city.DataValue;
    if (city0 != null)
    {
        mappath=mappath+"+"+city0;
    }

    var strt0= crmForm.all.address1_line1.DataValue;
    if (strt0 != null)
    {
        mappath=mappath+"+"+strt0;
    }
    var city0= crmForm.all.address1_postalcode.DataValue;
    if (city0 != null)
    {
        mappath=mappath+"+"+city0;
    }
    crmForm.all.IFRAME_LocationMAP.src=mappath;

    3、客户实体的onsave事件注入同上完全一样的js代码。

    保存然后发布就OK了。

    2009年7月20日 2:13

全部回复

  • 思路:Iframe嵌入地图,页面onload事件判断,地址一是否有值,有就把值带入地图搜索。
    具体怎么做不清楚,没做过,这个要自己试。
    2009年7月17日 8:24
  • 参考一下以下的 Blog 把, 不难做。

    http://community.dynamics.com/blogs/crminogic/archive/2009/04/27/maps-integration-for-dynamics-crm-4.aspx


    Darren Liu | 刘嘉鸿 | MS CRM MVP | English Blog: http://msdynamicscrm-e.blogspot.com | Chinese Blog: http://liudarren.spaces.live.com
    2009年7月17日 18:14
    版主
  • 解决了。
    参考了几篇文章

    http://www.qiuhao.com/dispbbs.asp?BoardID=26&ID=2725
    还研究一下google地图搜索参数格式,把qiuhao上的那篇文章改了改,就行了。发觉还是google的比较好用。

    1、先在客户实体中新建一个叫地图的标签,在里面建一个节,再在节里建一个IFRame,命名为IFRAME_LocationMAP;URL指向http://ditu.google.com/
        再在客户实体中新建一个叫公司网站的标签,在里面建一个节,再在节里建一个IFRame,命名为IFRAME_Website;URL地址随便写,但必须是一个网址的格式。

    2、在常规标签中所有与地址相关的字段的onchange事件注入js代码为

    var AccountURL = crmForm.all.websiteurl.DataValue;
    if (AccountURL != null)
    {
       crmForm.all.IFRAME_Website.src=AccountURL;
    }
    var mappath=" http://ditu.google.com/maps?f=q&hl=zh-CN&q=";
    var cnty0=crmForm.all.address1_country.DataValue;
    if (cnty0 != null)
    {
         mappath=mappath+cnty0;
     }
    var city0= crmForm.all.address1_stateorprovince.DataValue;
    if (city0 != null)
    {
        mappath=mappath+"+"+city0;
    }
    var city0= crmForm.all.address1_city.DataValue;
    if (city0 != null)
    {
        mappath=mappath+"+"+city0;
    }

    var strt0= crmForm.all.address1_line1.DataValue;
    if (strt0 != null)
    {
        mappath=mappath+"+"+strt0;
    }
    var city0= crmForm.all.address1_postalcode.DataValue;
    if (city0 != null)
    {
        mappath=mappath+"+"+city0;
    }
    crmForm.all.IFRAME_LocationMAP.src=mappath;

    3、客户实体的onsave事件注入同上完全一样的js代码。

    保存然后发布就OK了。

    2009年7月20日 2:13