问题
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
- 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>
- If you have Web resource name as "new_/sample.html" then we need to refer as below
<script src="../ClientGlobalContext.js.aspx"></script>
- 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