Skip to content

Commit 55b53b6

Browse files
authored
Merge pull request #4540 from MicrosoftDocs/Nava-clientapi
Adding new client APIs
2 parents ff03d89 + 090fb29 commit 55b53b6

File tree

6 files changed

+118
-16
lines changed

6 files changed

+118
-16
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@
164164
href: clientapi/reference/save-event-arguments/isDefaultPrevented.md
165165
- name: preventDefault
166166
href: clientapi/reference/save-event-arguments/preventDefault.md
167+
- name: preventDefaultOnError
168+
href: clientapi/reference/save-event-arguments/preventDefaultOnError.md
167169
- name: Attributes
168170
href: clientapi/reference/attributes.md
169171
items:
@@ -238,6 +240,8 @@
238240
href: clientapi/reference/controls/addNotification.md
239241
- name: addOnLookupTagClick
240242
href: clientapi/reference/controls/addOnLookupTagClick.md
243+
- name: addOnPostSave
244+
href: clientapi/reference/controls/addOnPostSave.md
241245
- name: addOnPostSearch
242246
href: clientapi/reference/controls/addOnPostSearch.md
243247
- name: addOnResultOpened
@@ -302,6 +306,8 @@
302306
href: clientapi/reference/controls/refresh.md
303307
- name: removeOnLookupTagClick
304308
href: clientapi/reference/controls/removeOnLookupTagClick.md
309+
- name: removeOnPostSave
310+
href: clientapi/reference/controls/removeOnPostSave.md
305311
- name: removeOnPostSearch
306312
href: clientapi/reference/controls/removeOnPostSearch.md
307313
- name: removeOnResultOpened
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: "addOnPostSave (Client API reference) in model-driven apps| MicrosoftDocs"
3+
description: Includes description and supported parameters for the addOnPostSave method.
4+
ms.date: 05/19/2021
5+
ms.service: powerapps
6+
ms.topic: "reference"
7+
applies_to: "Dynamics 365 (online)"
8+
ms.assetid: c398dbca-0ead-487a-8a92-35b1f2953bf6
9+
author: "Nkrb"
10+
ms.author: "nabuthuk"
11+
manager: "kvivek"
12+
search.audienceType:
13+
- developer
14+
search.app:
15+
- PowerApps
16+
- D365CE
17+
---
18+
# addOnPostSave (Client API reference)
19+
20+
Adds an event handler to be called after the record is saved with success or failure.
21+
22+
## Syntax
23+
24+
```javascript
25+
formContext.data.entity.addOnPostSave(myFunction);
26+
```
27+
28+
### Parameter
29+
30+
|Name|Type|Required|Description|
31+
|------|-----|------|----------|
32+
|myFunction|function reference|Yes|The function to be added to the `PostSave` event after teh record is saved with success or failure.|
33+
34+
### See also
35+
36+
[PostSave event](../events/postsave.md)
37+
38+
[removeOnPostSave](removeOnPostSave.md)
39+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: "removeOnPostSave (Client API reference) in model-driven apps| MicrosoftDocs"
3+
description: Includes description and supported parameters for the removeOnPostSave method.
4+
ms.date: 05/19/2021
5+
ms.service: powerapps
6+
ms.topic: "reference"
7+
applies_to: "Dynamics 365 (online)"
8+
ms.assetid: c398dbca-0ead-487a-8a92-35b1f2953bf6
9+
author: "Nkrb"
10+
ms.author: "nabuthuk"
11+
manager: "kvivek"
12+
search.audienceType:
13+
- developer
14+
search.app:
15+
- PowerApps
16+
- D365CE
17+
---
18+
# removeOnPostSave (Client API reference)
19+
20+
Removes the event handler from the [PostSave](../events/postsave.md) event.
21+
22+
## Syntax
23+
24+
```javascript
25+
formContext.data.entity.removeOnPostSave(myFunction);
26+
```
27+
28+
### Parameter
29+
30+
|Name|Type|Required|Description|
31+
|------|-----|------|----------|
32+
|myFunction|function reference|Yes|The function to be removed from the `PostSave` event.|
33+
34+
### See also
35+
36+
[PostSave event](../events/postsave.md)
37+
38+
[addOnPostSave](addOnPostSave.md)
39+

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

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,10 @@ search.app:
2020

2121
PostSave event occurs after the `OnSave` event is complete. This event is used to support or execute custom logic using web resources to perform after `Save` actions when the `save` event is successful or failed due to server errors.
2222

23-
Use the `addOnPostSave` method to manage event handlers for this event.
23+
Use the [addOnPostSave](../controls/addOnPostSave.md) and [removeOnPostSave](../controls/removeOnPostSave.md) methods to manage event handlers for this event.
2424

2525
> [!NOTE]
26-
> This method is supported only on Unified Interface.
27-
28-
<!--Some of the post save events include which are used by one of the first party app Field Service.
29-
1) When we create a work order incident, read incident type, and retrieve all incident products where incident type is equal to incident type on work order incident, then create work order products.
30-
2) If work order incident is primary incident on work order, modifying the work order incident that is updates the primary inc
31-
When a primary contact phone number is updated, update the same on the account phone number.-->
26+
> This method is supported only on Unified Interface
3227
3328
## Syntax
3429

@@ -43,15 +38,6 @@ When a primary contact phone number is updated, update the same on the account p
4338

4439
[!INCLUDE[cc-terminology](../../../../data-platform/includes/cc-terminology.md)]
4540

46-
<!--Code Example:
47-
We call below method and it will display org name. For making decisions on whether the save succeeded or failed, executioncontext object will have params such as
48-
1) getIsSaveSuccess() - use this method to know if the save operation on the entity succeeds or fails
49-
Usage - executionContext.getEventArgs(). getIsSaveSuccess();
50-
2) getEntityReference() - it will have entity info being saved/updated in case of success such as entity id, entity name (for eg., account or contact)
51-
Usage - executionContext.getEventArgs(). getEntityReference();
52-
3) getSaveErrorInfo() - Error details on why an entity save failed.
53-
Usage - executionContext.getEventArgs(). getSaveErrorInfo ();-->
54-
5541
### Example
5642

5743
The following sample code displays organization unique name as form notification.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Cancels the save operation if the event handler has a script error, returns a rejected promise for an async event handler or the operation times out.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: "preventDefaultOnError (Client API reference) in model-driven apps| MicrosoftDocs"
3+
description: Includes description and supported parameters for the preventDefaultOnError method.
4+
ms.date: 05/18/2021
5+
ms.service: powerapps
6+
ms.topic: "reference"
7+
applies_to: "Dynamics 365 (online)"
8+
ms.assetid: 9a8802ad-80aa-4386-a192-573280587546
9+
author: "Nkrb"
10+
ms.author: "nabuthuk"
11+
manager: "kvivek"
12+
search.audienceType:
13+
- developer
14+
search.app:
15+
- PowerApps
16+
- D365CE
17+
---
18+
# preventDefaultOnError (Client API reference)
19+
20+
[!INCLUDE[./includes/preventDefaultOnError-description.md](./includes/preventDefaultOnError-description.md)]
21+
22+
## Syntax
23+
24+
`executionContext.getEventArgs().preventDefaultOnError();`
25+
26+
27+
### Related topics
28+
29+
[getSaveMode](getSaveMode.md)
30+
31+
[isDefaultPrevented](isDefaultPrevented.md)

0 commit comments

Comments
 (0)