简体   繁体   English

调整 CRM 站点地图,为不同环境提供不同的 URL 导航

[英]Tweak CRM Sitemap to have different URL navigations for different environments

We want to have different Sitemap subarea Url, so that the Sitemap can be independent of environments & worryfree when we refresh the environments from higher region to lower.我们希望有不同的Sitemap子区域Url,这样Sitemap就可以独立于环境,从高到低刷新环境时无忧无虑。 Even deployments can be error free & can avoid manual step in post deployment activity.甚至部署也可以是无错误的,并且可以避免部署后活动中的手动步骤。

Dev:开发:

<SubArea Id="nav_hub" ResourceId="Hub_SubArea_Title" DescriptionResourceId="Hub_SubArea_Description" 
   ToolTipResourseId="Hub_SubArea_ToolTip" Icon="/_imgs/Hub_32.png" 
     Url="http://mydevhub.com/home.aspx" AvailableOffline="false" />

UAT: UAT:

<SubArea Id="nav_hub" ResourceId="Hub_SubArea_Title" DescriptionResourceId="Hub_SubArea_Description" 
    ToolTipResourseId="Hub_SubArea_ToolTip" Icon="/_imgs/Hub_32.png" 
       Url="http://myuathub.com/home.aspx" AvailableOffline="false" />

Any idea to do that?有什么想法可以这样做吗?

I ended up doing this workaround as we cannot pass dynamic variable url to Sitemap.我最终做了这个解决方法,因为我们无法将动态变量 url 传递给站点地图。

1.Created a Sub-Area with url to custom HTML web resource as below: 1.创建一个带有url到自定义HTML网络资源的子区域,如下所示:

$webresource:pub/Scripts/External/navigation.html

2.Just used the below content to open a new window based on org url: 2.刚刚使用以下内容基于org url打开一个新窗口:

<html><head>
<script src="../../../ClientGlobalContext.js.aspx" type="text/javascript"></script>
<script language="javascript">
var crmUrl = parent.Xrm.Page.context.getClientUrl();

if (crmUrl.indexOf('devinstance.crm.dynamics.com') > 0)
            parent.window.open('http://mydevhub.com/home.aspx');

if (crmUrl.indexOf('uatinstance.crm.dynamics.com') > 0)
            parent.window.open('http://myuathub.com/home.aspx');

</script>
</head><body>
</body></html>

In case anyone else lands here (and since I can't comment yet) the answer provided is deprecated.万一其他人来到这里(因为我还不能发表评论),所提供的答案已被弃用。

The newer way of achieving this is实现这一目标的较新方法是

var globalContext = Xrm.Utility.getGlobalContext();
globalContext.getClientUrl();

( Source ) 来源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM