A while back, I had two posts concerning the execution of Fetch against the 2011 service (
In these examples, I’m going to demonstrate executing the
Inside of a JavaScript Web Resource
To access the getServerUrl() method, simply use:
Xrm.Page.context.getServerUrl()
Inside of an embedded HTML Web Resource (aka an IFrame)
Now since we’re talking context, you can always reference the “ClientGlobalContext.js.aspx” and use:
But I’m wanting more than what’s inside Xrm.Page.context; I want everything inside the “Xrm” variable. For this we can use:
window.parent.Xrm.Page.context.getServerUrl()
To use the “window.parent.Xrm”, you will need to make sure Cross-Scripting is enabled.
Inside of Developer Tools (F12)
I’ve seen people use crmForm.all and then use the CRM 4 to CRM 2011 conversion utility to code. Instead, it’s much easier to use:
document.getElementById('contentIFrame').contentWindow.Xrm.Page.context.getServerUrl()
Summary
If you aren’t familiar with Execution Context, I would recommend
Post by: Paul Way,