XRM context in HTML webreource in MSCRM 2016

半城伤御伤魂 提交于 2019-12-24 16:18:12

问题


I am facing a problem when HTML web resource which gets popped up on clicking of some ribbon button.

It does not have the Xrm context as it is unable to load the file clientglobalcontext.js.aspx

Here is what I have included in source of HTML: src="../ClientGlobalContext.js.aspx" and also used this src="ClientGlobalContext.js.aspx"

This is working in my current CRM11 version but it does not get load in CRM16 online. Is there any other way to load this file in a popped up html window or it is not possible to access the XRM context from separate HTML file in CRM 2016 ?

Much Thank You.


回答1:


There are some things you need to consider

  1. Using a relative path including the root WebResources folder, for example, /WebResources/ClientGlobalContext.js.aspx, is not recommended because it can cause the page to lose organization context in a multi-tenant environment.

2.If you have Web resource name as "new_sample.html" then we need to refer as below

 <script src="ClientGlobalContext.js.aspx"></script>
  1. If you have Web resource name as "new_/sample.html" then we need to refer as below

<script src="../ClientGlobalContext.js.aspx"></script>
  1. If you have Web resource name as "new_/content/sample.html" then we need to refer as below

<script src="../../ClientGlobalContext.js.aspx"></script>


来源:https://stackoverflow.com/questions/38502033/xrm-context-in-html-webreource-in-mscrm-2016

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!