Tapahtumat
14. helmik. klo 16 - 31. maalisk. klo 16
Kun sinulla on neljä mahdollisuutta osallistua, voit voittaa konferenssipaketin ja päästä LIVE Grand Finaleen Las Vegasissa
LisätietojaTätä selainta ei enää tueta.
Päivitä Microsoft Edgeen, jotta voit hyödyntää uusimpia ominaisuuksia, suojauspäivityksiä ja teknistä tukea.
Use the GetGlobalContext function when programming with web resources to gain access to the global context information such as the information specific to the client, organization, or user for your model-driven apps instance.
To get access to the GetGlobalContext function in your HTML web resource, include a reference to ClientGlobalContext.js.aspx.
Tärkeä
Including a reference to ClientGlobalContext.js.aspx does not make the Xrm object available in HTML web resources. Therefore, scripts containing Xrm.*
methods aren't supported in HTML web resources. parent.Xrm.*
will work if the HTML web resource is loaded in a form container. However, for other places, such as loading an HTML web resource as part of the SiteMap, parent.Xrm.*
also won't work.
The GetGlobalContext function returns the same context object as returned by the Xrm.Utility.getGlobalContext method, which implies that the context object has the same properties and methods as available for Xrm.Utility.getGlobalContext. More information: Xrm.Utility.getGlobalContext
You must include a reference to the ClientGlobalContext.js.aspx page located at the root of the web resources directory to be able to use the GetGlobalContext function.
If you aren't using slash characters in HTML web resource names to simulate a folder structure, you can include this script by directly referring to it. For example:
<head>
<title>HTML Web Resource</title>
<script src="ClientGlobalContext.js.aspx" type="text/javascript" ></script>
</head>
If you're using backslash characters in HTML web resource names to simulate a directory structure, you must do the same in your script element. The following example is for an HTML web resource named sdk_/Contoso.htm and a JavaScript web resource named sdk_/Scripts/ContosoScript.js with a CSS web resource named sdk_/Styles/ContosoStyles.css.
<head>
<title>HTML Web Resource</title>
<script src="../ClientGlobalContext.js.aspx" type="text/javascript" ></script>
<script src="Scripts/ContosoScript.js" type="text/javascript"></script>
<link href="Styles/ContosoStyles.css" rel="stylesheet" type="text/css" />
</head>
Huomautus
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.
The ClientGlobalContext.js.aspx page includes some global event handlers. These event handlers cancel the onselectstart, contextmenu, and ondragstart events.
Xrm.Utility.getGlobalContext
Understand Client API object model
Web resources for model-driven apps
Tapahtumat
14. helmik. klo 16 - 31. maalisk. klo 16
Kun sinulla on neljä mahdollisuutta osallistua, voit voittaa konferenssipaketin ja päästä LIVE Grand Finaleen Las Vegasissa
LisätietojaOpetus
Moduuli
Automate business processes with client script - Training
This module focuses on educating developers on how to perform common techniques in regard to automating business processes using client scripting, along with explaining the context of when these scenarios might be applied.
Ohjeet
Xrm.Utility (Client API reference) - Power Apps
Provides container for useful methods.
getPageContext (Client API reference) in model-driven apps - Power Apps
Includes description and supported parameters for the getPageContext method.
getFormContext (Client API reference) in model-driven apps - Power Apps
Learn about the getFormContext method that returns a reference to the form or an item on the form depending on where the method was called.