Skip to content

Commit 2eb68d9

Browse files
authored
Merge pull request MicrosoftDocs#2379 from MicrosoftDocs/clientapi-deprecation
Clientapi updates
2 parents 5129bed + 996d141 commit 2eb68d9

File tree

5 files changed

+144
-7
lines changed

5 files changed

+144
-7
lines changed

powerapps-docs/developer/model-driven-apps/clientapi/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@
168168
href: reference/controls/clearOptions.md
169169
- name: getAttribute
170170
href: reference/controls/getAttribute.md
171+
- name: getContentWindow
172+
href: reference/controls/getContentWindow.md
171173
- name: getControl
172174
href: reference/controls/getControl.md
173175
- name: getControlType

powerapps-docs/developer/model-driven-apps/clientapi/reference/Xrm-Utility/getGlobalContext/organizationSettings.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: "getGlobalContext.organizationSettings (Client API reference) in model-driven apps| MicrosoftDocs"
3-
ms.date: 10/31/2018
3+
ms.date: 02/06/2020
44
ms.service: powerapps
55
ms.topic: "reference"
66
applies_to: "Dynamics 365 (online)"
77
ms.assetid: badf4f82-cb47-4864-aa43-bb777d04de4d
88
author: "KumarVivek"
99
ms.author: "kvivek"
10-
manager: "amyla"
10+
manager: "annbe"
1111
search.audienceType:
1212
- developer
1313
search.app:
@@ -42,6 +42,8 @@ Returns attributes and their values as `key:value` pairs that are available for
4242

4343
Returns the ID of the base currency for the current organization.
4444

45+
Deprecated; use [organizationSettings.baseCurrency](#basecurrency) instead to access the display name along with the ID of the base currency.
46+
4547
### Syntax
4648

4749
`organizationSettings.baseCurrencyId`
@@ -50,7 +52,23 @@ Returns the ID of the base currency for the current organization.
5052

5153
**Type**: String
5254

53-
**Description**: ID of the base currency.
55+
**Description**: ID of the base currency.
56+
57+
## baseCurrency
58+
59+
Returns a lookup object containing the ID, name, and entity type of the base currency for the current organization.
60+
61+
### Syntax
62+
63+
`organizationSettings.baseCurrency`
64+
65+
### Return Value
66+
67+
**Type**: Lookup Object
68+
69+
**Description**: Object containing the `id`, `name`, and `entityType` of the base currency. For example:
70+
71+
`{id: "e7dd9bc6-d239-ea11-a813-000d3a35b14a", entityType: "transactioncurrency", name: "US Dollar"}`
5472

5573
## defaultCountryCode
5674

powerapps-docs/developer/model-driven-apps/clientapi/reference/Xrm-Utility/getGlobalContext/userSettings.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "getGlobalContext.userSettings (Client API reference) in model-driven apps| MicrosoftDocs"
3-
ms.date: 10/31/2018
3+
ms.date: 02/06/2020
44
ms.service: powerapps
55
ms.topic: "reference"
66
applies_to: "Dynamics 365 (online)"
@@ -108,6 +108,20 @@ Returns the language ID for the current user.
108108

109109
**Description**: Language ID.
110110

111+
## roles
112+
113+
Returns a collection of lookup objects containing the GUID and display name of each of the security role or teams that the user is associated with.
114+
115+
### Syntax
116+
117+
`userSettings.roles`
118+
119+
### Return Value
120+
121+
**Type**: Array of objects
122+
123+
**Description**: Object containing `id` and `name` of each of the security role or teams that the user is associated with.
124+
111125
## securityRolePrivileges
112126

113127
Returns an array of strings that represent the GUID values of each of the security role privilege that the user is associated with or any teams that the user is associated with.
@@ -124,7 +138,9 @@ Returns an array of strings that represent the GUID values of each of the securi
124138

125139
## securityRoles
126140

127-
Returns an array of strings that represent the GUID values of each of the security role that the user is associated with or any teams that the user is associated with.
141+
Returns an array of strings that represent the GUID values of each of the security role or teams that the user is associated with.
142+
143+
Deprecated; use [userSettings.roles](#roles) instead to view the display names of security roles or teams along with the ID.
128144

129145
### Syntax
130146

@@ -138,10 +154,28 @@ Returns an array of strings that represent the GUID values of each of the securi
138154

139155
`["0d3dd20a-17a6-e711-a94e-000d3a1a7a9b", "ff42d20a-17a6-e711-a94e-000d3a1a7a9b"]`
140156

157+
## transactionCurrency
158+
159+
Returns a lookup object containing the ID, display name, and entity type of the transaction currency for the current user.
160+
161+
### Syntax
162+
163+
`userSettings.transactionCurrency`
164+
165+
### Return Value
166+
167+
**Type**: Lookup object
168+
169+
**Description**: Object containing the `id`, `name`, and `entityType` of the transaction currency. For example:
170+
171+
`{id: "e7dd9bc6-d239-ea11-a813-000d3a35b14a", entityType: "transactioncurrency", name: "US Dollar"}`
172+
141173
## transactionCurrencyId
142174

143175
Returns the transaction currency ID for the current user.
144176

177+
Deprecated; use [userSettings.transactionCurrency](#transactioncurrency) instead to access the display name along with the ID.
178+
145179
### Syntax
146180

147181
`userSettings.transactionCurrencyId`

powerapps-docs/developer/model-driven-apps/clientapi/reference/controls.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,27 @@ These are the methods available for an IFRAME control.
7575
<tr>
7676
<td>
7777
<ul>
78+
<li><a href="controls/getContentWindow.md" data-raw-source="[getContentWindow](controls/getContentWindow.md)">getContentWindow</a></li>
7879
<li><a href="controls/getControlType.md" data-raw-source="[getControlType](controls/getControlType.md)">getControlType</a></li>
7980
<li><a href="controls/getDisabled.md" data-raw-source="[getDisabled](controls/getDisabled.md)">getDisabled</a></li>
8081
<li><a href="controls/getInitialUrl.md" data-raw-source="[getInitialUrl](controls/getInitialUrl.md)">getInitialUrl</a></li>
8182
<li><a href="controls/getLabel.md" data-raw-source="[getLabel](controls/getLabel.md)">getLabel</a></li>
82-
<li><a href="controls/getName.md" data-raw-source="[getName](controls/getName.md)">getName</a></li>
83+
8384
</ul>
8485
</td>
8586
<td>
8687
<ul>
88+
<li><a href="controls/getName.md" data-raw-source="[getName](controls/getName.md)">getName</a></li>
8789
<li><a href="controls/getObject.md" data-raw-source="[getObject](controls/getObject.md)">getObject</a></li>
8890
<li><a href="controls/getParent.md" data-raw-source="[getParent](controls/getParent.md)">getParent</a></li>
8991
<li><a href="controls/getSrc.md" data-raw-source="[getSrc](controls/getSrc.md)">getSrc</a></li>
9092
<li><a href="controls/getVisible.md" data-raw-source="[getVisible](controls/getVisible.md)">getVisible</a></li>
91-
<li><a href="controls/setDisabled.md" data-raw-source="[setDisabled](controls/setDisabled.md)">setDisabled</a></li>
93+
9294
</ul>
9395
</td>
9496
<td>
9597
<ul>
98+
<li><a href="controls/setDisabled.md" data-raw-source="[setDisabled](controls/setDisabled.md)">setDisabled</a></li>
9699
<li><a href="controls/setFocus.md" data-raw-source="[setFocus](controls/setFocus.md)">setFocus</a></li>
97100
<li><a href="controls/setLabel.md" data-raw-source="[setLabel](controls/setLabel.md)">setLabel</a></li>
98101
<li><a href="controls/setSrc.md" data-raw-source="[setSrc](controls/setSrc.md)">setSrc</a></li>
@@ -281,6 +284,7 @@ These are the methods available for the timer control.
281284
<tr>
282285
<td>
283286
<ul>
287+
284288
<li><a href="controls/getControlType.md" data-raw-source="[getControlType](controls/getControlType.md)">getControlType</a></li>
285289
<li><a href="controls/getDisabled.md" data-raw-source="[getDisabled](controls/getDisabled.md)">getDisabled</a></li>
286290
<li><a href="controls/getLabel.md" data-raw-source="[getLabel](controls/getLabel.md)">getLabel</a></li>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: "getContentWindow (Client API reference) in model-driven apps| MicrosoftDocs"
3+
ms.date: 02/06/2020
4+
ms.service: powerapps
5+
ms.topic: "reference"
6+
ms.assetid: ad68d177-3715-468e-b4af-8cf9b3c77799
7+
author: "KumarVivek"
8+
ms.author: "kvivek"
9+
manager: "annbe"
10+
search.audienceType:
11+
- developer
12+
search.app:
13+
- PowerApps
14+
- D365CE
15+
---
16+
# getContentWindow (Client API reference)
17+
18+
Returns the content window that represents an IFRAME or web resource.
19+
20+
> [!NOTE]
21+
> This method is supported only on [Unified Interface](/powerapps/user/unified-interface).
22+
23+
## Control types supported
24+
25+
iframe, web resource
26+
27+
## Syntax
28+
29+
```JavaScript
30+
formContext.getControl(arg).getContenWindow().then(successCallback, errorCallback);
31+
```
32+
33+
## Parameters
34+
35+
|Name |Type|Required|Description|
36+
|---|---|---|---|
37+
|successCallback|Function|No|A function to call when operation is executed successfully. A content window instance representing the IFRAME or web resource is passed to the function.|
38+
|errorCallback|Function|No|A function to call when the operation fails.|
39+
40+
41+
## Return Value
42+
43+
On success, returns a promise that contains a content window instance representing an IFRAME or web resource.
44+
45+
## Example
46+
47+
The following example shows how you can use this method with a HTML Web resource (new_myWebResource.htm).
48+
49+
First, add the following code in your HTML web resource:
50+
51+
```javascript
52+
// This script should be in the HTML web resource.
53+
// No usage of Xrm or formContext should happen until this method is called.
54+
function setClientApiContext(xrm, formContext) {
55+
// Optionally set Xrm and formContext as global variables on the page.
56+
window.Xrm = xrm;
57+
window._formContext = formContext;
58+
59+
// Add script logic here that uses xrm or the formContext.
60+
}
61+
```
62+
63+
Next, add the following code in the form onLoad event handler:
64+
65+
```javascript
66+
// This should be in a script loaded on the form.
67+
// form_onload is a handler for the form onload event.
68+
function form_onload(executionContext) {
69+
var formContext = executionContext.getFormContext();
70+
var wrControl = formContext.getControl("new_myWebResource.htm");
71+
if (wrControl) {
72+
wrControl.getContentWindow().then(
73+
function (contentWindow) {
74+
contentWindow.setClientApiContext(Xrm, formContext);
75+
}
76+
)
77+
}
78+
}
79+
```

0 commit comments

Comments
 (0)