Skip to content

Commit 8e41973

Browse files
authored
Live publish
2 parents 8e75abc + d59850a commit 8e41973

16 files changed

+404
-24
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,13 @@
595595
href: reference/grids/viewselector/isVisible.md
596596
- name: setCurrentView
597597
href: reference/grids/viewselector/setCurrentView.md
598+
- name: Xrm.App
599+
href: reference/xrm-app.md
600+
items:
601+
- name: addGlobalNotification
602+
href: reference/xrm-app/addGlobalNotification.md
603+
- name: clearGlobalNotification
604+
href: reference/xrm-app/clearGlobalNotification.md
598605
- name: Xrm.Device
599606
href: reference/xrm-device.md
600607
items:
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
---
2+
title: "addGlobalNotification (Client API reference) in model-driven apps| MicrosoftDocs"
3+
ms.date: 03/09/2020
4+
ms.service: powerapps
5+
ms.topic: "reference"
6+
author: "KumarVivek"
7+
ms.author: "kvivek"
8+
manager: "annbe"
9+
search.audienceType:
10+
- developer
11+
search.app:
12+
- PowerApps
13+
---
14+
# addGlobalNotification (Client API reference)
15+
16+
[This topic is pre-release documentation and is subject to change.]
17+
18+
[!INCLUDE[./includes/addGlobalNotification-description.md](./includes/addGlobalNotification-description.md)]
19+
20+
> [!NOTE]
21+
> This is a preview feature, and is supported only on Unified Interface.
22+
23+
## Syntax
24+
25+
`Xrm.App.addGlobalNotification(notification).then(successCallback, errorCallback);`
26+
27+
## Parameters
28+
29+
<table style="width:100%">
30+
<tr>
31+
<th>Name</th>
32+
<th>Type</th>
33+
<th>Required</th>
34+
<th>Description</th>
35+
</tr>
36+
<tr>
37+
<td>notification</td>
38+
<td>Object</td>
39+
<td>Yes</td>
40+
<td>The notification to add. The object contains the following attributes:
41+
<ul>
42+
<li><b>action</b>: (Optional) Object. Contains the following attributes:
43+
<ul>
44+
<li><b>actionLabel</b>: (Optional) String. The label for the action in the message.</li>
45+
<li><b>eventHandler</b>: (Optional) Function reference. The function to execute when the action label is clicked.</li>
46+
</ul>
47+
<li><b>level</b>: Number. Defines the level of notification. Valid values are:
48+
<ul><li>1: Success</li>
49+
<li>2: Error</li>
50+
<li>3: Warning</li>
51+
<li>4: Information</li></ul></li>
52+
<li><b>message</b>: String. The message to display in the notification.</li>
53+
<li><b>showCloseButton</b>: (Optional) Boolean. Indicates whether or not the user can close or dismiss the notification. If you don't specify this parameter, users can't close or dismiss the notification by default.</li>
54+
<li><b>type</b>: Number. Defines the type of notification. Currently, only a value of 2 is supported, which displays a message bar at the top of the app.</li>
55+
</ul></td>
56+
</tr>
57+
<tr>
58+
<td>successCallback</td>
59+
<td>Function</td>
60+
<td>No</td>
61+
<td><p>A function to call when notification is displayed. A GUID value is passed to uniquely identify the notification. You can use the GUID value to close or dismiss the notification using the <a href="clearGlobalNotification.md">clearGlobalNotification</a> method.</p>
62+
</td>
63+
</tr>
64+
<tr>
65+
<td>errorCallback</td>
66+
<td>Function</td>
67+
<td>No</td>
68+
<td>A function to call when the operation fails.</td>
69+
</tr>
70+
</table>
71+
72+
## Return Value
73+
74+
On success, returns a promise object containing a GUID value to uniquely identify the notification as described earlier in the description of the **successCallback** parameter.
75+
76+
## Examples
77+
78+
### Display an error notification that can't be closed or dismissed by user
79+
80+
```JavaScript
81+
// define notification object
82+
var notification =
83+
{
84+
type: 2,
85+
level: 2, //error
86+
message: "Test error notification"
87+
}
88+
89+
Xrm.App.addGlobalNotification(notification).then(
90+
function success(result) {
91+
console.log("Notification created with ID: " + result);
92+
// perform other operations as required on notification display
93+
},
94+
function (error) {
95+
console.log(error.message);
96+
// handle error conditions
97+
}
98+
);
99+
```
100+
101+
This is how the error notification will appear in the app:
102+
103+
![Example error notification](media/add-global-error.png "Example error notification")
104+
105+
### Display a warning notification that can be closed or dismissed by user
106+
107+
```JavaScript
108+
// define notification object
109+
var notification =
110+
{
111+
type: 2,
112+
level: 3, //warning
113+
message: "Test warning notification",
114+
showCloseButton: true
115+
}
116+
117+
Xrm.App.addGlobalNotification(notification).then(
118+
function success(result) {
119+
console.log("Notification created with ID: " + result);
120+
// perform other operations as required on notification display
121+
},
122+
function (error) {
123+
console.log(error.message);
124+
// handle error conditions
125+
}
126+
);
127+
```
128+
129+
This is how the warning notification will appear in the app:
130+
131+
![Example warning notification](media/add-global-warning.png "Example warning notification")
132+
133+
### Display an information notification with a "Learn more" link that can be clicked by users
134+
135+
```javascript
136+
// define action object
137+
var myAction =
138+
{
139+
actionLabel: "Learn more",
140+
eventHandler: function () {
141+
Xrm.Navigation.openUrl("https://docs.microsoft.com/powerapps/");
142+
// perform other operations as required on clicking
143+
}
144+
}
145+
146+
// define notification object
147+
var notification =
148+
{
149+
type: 2,
150+
level: 4, // information
151+
message: "Test information notification",
152+
action: myAction
153+
}
154+
155+
Xrm.App.addGlobalNotification(notification).then(
156+
function success(result) {
157+
console.log("Notification created with ID: " + result);
158+
// perform other operations as required on notification display
159+
},
160+
function (error) {
161+
console.log(error.message);
162+
// handle error conditions
163+
}
164+
);
165+
```
166+
167+
This is how the information notification will appear in the app:
168+
169+
![Example information notification](media/add-global-information.png "Example information notification")
170+
171+
### See also
172+
173+
[clearGlobalNotification](clearGlobalnotification.md)
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: "clearGlobalNotification (Client API reference) in model-driven apps| MicrosoftDocs"
3+
ms.date: 03/09/2020
4+
ms.service: powerapps
5+
ms.topic: "reference"
6+
author: "KumarVivek"
7+
ms.author: "kvivek"
8+
manager: "annbe"
9+
search.audienceType:
10+
- developer
11+
search.app:
12+
- PowerApps
13+
---
14+
# clearGlobalNotification (Client API reference)
15+
16+
[This topic is pre-release documentation and is subject to change.]
17+
18+
[!INCLUDE[./includes/clearGlobalNotification-description.md](./includes/clearGlobalNotification-description.md)]
19+
20+
> [!NOTE]
21+
> This is a preview feature, and is supported only on Unified Interface.
22+
23+
## Syntax
24+
25+
`Xrm.App.clearGlobalNotification(uniqueId).then(successCallback, errorCallback);`
26+
27+
## Parameters
28+
29+
<table style="width:100%">
30+
<tr>
31+
<th>Name</th>
32+
<th>Type</th>
33+
<th>Required</th>
34+
<th>Description</th>
35+
</tr>
36+
<tr>
37+
<td>uniqueId</td>
38+
<td>String</td>
39+
<td>Yes</td>
40+
<td>The ID to use to clear a specific notification that was set using <a href="addGlobalNotification.md">addGlobalNotification</a>.
41+
</td>
42+
</tr>
43+
<tr>
44+
<td>successCallback</td>
45+
<td>Function</td>
46+
<td>No</td>
47+
<td><p>A function to call when the notification is cleared.</p>
48+
</td>
49+
</tr>
50+
<tr>
51+
<td>errorCallback</td>
52+
<td>Function</td>
53+
<td>No</td>
54+
<td>A function to call when the operation fails.</td>
55+
</tr>
56+
</table>
57+
58+
## Return Value
59+
60+
On success, returns a promise object.
61+
62+
## Examples
63+
64+
The following example shows how to add a notification and then close it automatically after 5 seconds.
65+
66+
```JavaScript
67+
// define notification object
68+
var notification =
69+
{
70+
type: 2,
71+
level: 3, //warning
72+
message: "Test warning notification"
73+
}
74+
75+
Xrm.App.addGlobalNotification(notification).then(
76+
function success(result) {
77+
console.log("Notification created with ID: " + result);
78+
79+
// Wait for 5 seconds and then clear the notification
80+
window.setTimeout(function () {
81+
Xrm.App.clearGlobalNotification(result); }, 5000);
82+
},
83+
function (error) {
84+
console.log(error.message);
85+
// handle error conditions
86+
}
87+
);
88+
```
89+
90+
### See also
91+
92+
[addGlobalNotification](addGlobalnotification.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Displays an error, information, warning, or success notification for an app, and lets you specify actions to execute based on the notification.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Clears a notification in the app.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ search.app:
1919

2020

2121
> [!NOTE]
22-
> This method is supported only on the Unified Interface.
22+
> This method is supported only on Unified Interface.
2323
2424
## Syntax
2525

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: "Xrm.App (Client API reference) in model-driven apps| MicrosoftDocs"
3+
ms.date: 03/04/2020
4+
ms.service: powerapps
5+
ms.topic: "reference"
6+
author: "KumarVivek"
7+
ms.author: "kvivek"
8+
manager: "annbe"
9+
search.audienceType:
10+
- developer
11+
search.app:
12+
- PowerApps
13+
---
14+
# Xrm.App (Client API reference)
15+
16+
Provides app-related methods.
17+
18+
|Method |Description |
19+
|---|---|
20+
|[addGlobalNotification](xrm-app/addGlobalNotification.md)|[!INCLUDE[xrm-app/includes/addGlobalNotification-description.md](xrm-app/includes/addGlobalNotification-description.md)]|
21+
|[clearGlobalNotification](xrm-app/clearGlobalNotification.md)|[!INCLUDE[xrm-app/includes/clearGlobalNotification-description.md](xrm-app/includes/clearGlobalNotification-description.md)]|
22+
23+
24+
### Related topics
25+
26+
[Client API Xrm object](../clientapi-xrm.md)
27+
28+
29+

0 commit comments

Comments
 (0)