Skip to content

Commit 242a66b

Browse files
committed
Merge branch 'main' into 2504813
2 parents 0d2b3d3 + 1c5f222 commit 242a66b

File tree

7 files changed

+77
-52
lines changed

7 files changed

+77
-52
lines changed

powerapps-docs/developer/model-driven-apps/clientapi/events-forms-grids.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ To add or remove event handler functions to events in the new Unified Interface:
5252

5353
---
5454

55+
### Bulk edit forms
56+
57+
By default, events handlers aren't called when a form is in bulk edit mode.
58+
59+
To enable an event handler in bulk edit mode, modify the Form XML by finding the relevant `event` element and creating/setting the `BehaviorInBulkEditForm` attribute to `Enabled`.
60+
61+
For more information on Form XML customization, see [When to edit the customizations file](../when-edit-customization-file.md), [Customize forms](../customize-entity-forms.md), and the [Form XML schema](../form-xml-schema.md).
62+
63+
To determine when an event handler is called on a form in bulk edit mode use [`getFormType`](reference/formContext-ui/getFormType.md) method.
64+
5565
## Add or remove event handler function to event using code
5666

5767
Using the following methods to add and remove event handler for events that cannot be associated through UI:
@@ -83,4 +93,4 @@ Use the [setSharedVariable](reference/executioncontext/setSharedVariable.md) and
8393

8494

8595

86-
[!INCLUDE[footer-include](../../../includes/footer-banner.md)]
96+
[!INCLUDE[footer-include](../../../includes/footer-banner.md)]
Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: "Form OnLoad event (Client API reference) in model-driven apps| MicrosoftDocs"
3-
description: Learn how to set the form OnLoad event.
4-
ms.date: 04/15/2021
3+
description: Includes description and supported parameters for the OnLoad event.
4+
ms.date: 12/16/2021
55
ms.service: powerapps
66
ms.topic: "reference"
77
applies_to: "Dynamics 365 (online)"
8-
ms.assetid: 89123cde-7c66-4c7d-94e4-e287285019f8
8+
ms.assetid: fb13c0a1-0e00-4592-8e58-3c2412141fbd
99
author: "Nkrb"
1010
ms.author: "nabuthuk"
1111
manager: "kvivek"
@@ -15,24 +15,49 @@ search.app:
1515
- PowerApps
1616
- D365CE
1717
---
18-
# Form OnLoad event (Client API reference)
18+
# Form OnLoad event
1919

20-
The form `OnLoad` event occurs after the form has loaded. It also occurs after a record is saved on create or update, and on refresh. For example by selecting the **Save** or the **Refresh** button on the main form. Use the `OnLoad` event to apply logic about how the form should be displayed, to set properties on columns, and interact with other page elements.
20+
This event occurs whenever form data is loaded, specifically:
2121

22-
You can determine in what context the `OnLoad` event occurs by using [getEventArgs](../executioncontext/getEventArgs.md). By doing so, you can apply logic conditional on the context.
22+
- On initial page load.
23+
- When the page data is explicitly refreshed using formContext.data.[refresh](../formContext-data/refresh.md) method.
24+
- When the data is refreshed on a page on saving a record, if there are any changes.
25+
26+
Use the formContext.data.[addOnLoad](../formContext-data/addOnLoad.md) and formContext.data.[removeOnLoad](../formContext-data/removeOnLoad.md) methods to manage event handlers for this event.
2327

24-
Data for related tables on a form, such as data for subgrids and quick view forms are not guaranteed to be available when the `OnLoad` event handler is executed. Logic that depends on related data should use the [Subgrid OnLoad](./subgrid-onload.md) event, quick view form should use the [isLoaded](../formcontext-ui-quickforms/isloaded.md) function, or the appropriate function for determining when the data should be loaded for the particular related data.
28+
## Asynchronous OnLoad event handler support
2529

26-
[!INCLUDE[cc-terminology](../../../../data-platform/includes/cc-terminology.md)]
30+
The `OnLoad` event handler has the ability to wait for promises returned by event handlers to settle before loading a form which allows for an OnLoad event to be asynchronous ("async"). The `OnLoad` event becomes async when the event handler returns a promise.
2731

28-
Controls and other UI of the form are not guaranteed to be rendered and in the DOM when the `OnLoad` event occurs. Logic in the `OnLoad` event handler cannot prevent the form from loading.
32+
The form loads when each promise returned by the event handler is resolved. For any promises that are returned, there is a 10 second limit for each promise. After that, the platform considers promises to be timed out. This timeout is applied per promise. For example, if you have five promises returned, the total wait time is 50 seconds.
33+
Suppose the promise is rejected or timed out. In that case, the form load operation behaves similarly to the current script errors.
2934

30-
The form `OnLoad` event is synchronous by default. However, you should **not** make synchronous network requests in an `OnLoad` event handler. This can cause a slow save experience and an unresponsive app. Instead, you should [asynchronous network requests](../../../best-practices/business-logic/interact-http-https-resources-asynchronously.md). Using asynchronous requests will [dramatically improve the performance of form loads](https://powerapps.microsoft.com/blog/turbocharge-your-model-driven-apps-by-transitioning-away-from-synchronous-requests/) compared to using synchronous requests. If a promise is returned by an event handler, the event becomes asynchronous and the form runtime will wait until the promise is settled before allowing the user to interact with the form.
35+
The `OnLoad` event will only wait for one promise returned per handler. If multiple promises are required, it is recommended to wrap all the promises in the `Promise.all()` method and return the single resulting promise. For multiple handlers that return a promise, we recommend that you create one handler that calls all the events and return a single promise that wraps all required promises. This is to minimize wait times caused by the timeout.
3136

32-
You should be careful when using asynchronous code in an `OnLoad` event handler that needs an action to be taken or handled on the resolution of the async code. Asynchronous code can cause issues if the resolution handler expects the app context to remain the same as it was when the asynchronous code has started. For example, there may be code in an `OnLoad` event handler to make a network request and change a control to be disabled based on the response data. Before the response from the request is received, the user may have interacted with the control or navigated to a different page, so there may be undesired behavior. If you need to not show data or UI before the asynchronous requests complete, your code can hide or disable the relevant UI until the requests are complete. Your code should also check that the user is in the same context after each asynchronous continuation point.
37+
### Enable Async OnLoad using app setting
3338

39+
To use async onLoad handlers, you will need to enable it through the app setting.
40+
An app setting is a platform component that allows you to turn supported features on or off for your app.
41+
To enable the async Onload event handlers for a specific app:
3442

43+
1. Go to https://make.powerapps.com.
44+
2. Make sure you select the correct environment.
45+
3. Select **Apps** from the left navigation pane.
46+
4. Select the app and then select **...** (ellipses). Select **Open in preview**.
47+
5. Select **Settings** in the command bar.
48+
6. When the dialog opens, select **Features**.
49+
7. Turn on **Async onload handler**.
50+
8. Select **Save**.
3551

52+
![Async OnLoad app setting](../../../media/async_onLoad_app_settings.png "Async OnLoad app setting")
53+
54+
### Async OnLoad timeouts
3655

56+
When using an async handler, a form load will wait for the promise to be fulfilled. To ensure that a load completes on time, the handler throws a timeout exception after 10 seconds to let you know to tune the async OnLoad event for better performance.
57+
58+
There may be scenarios where you want to halt the OnLoad execution, and the timeout will stop the operation from occurring. An example is opening a dialog in the async OnLoad and waiting for the user’s input before saving. To make sure the async operation will wait you can provide the event argument **disableAsyncTimeout**(executioncontext.getEventArgs().disableAsyncTimeout()).
59+
When the **disableAsyncTimeout is set, the timeout for that handler will not be applied. It will continue to wait for that handler's promise to be fulfilled.
60+
61+
This should be used with caution as it might affect the performance of the form load.
3762

3863
[!INCLUDE[footer-include](../../../../../includes/footer-banner.md)]

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

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Form OnSave event (Client API reference) in model-driven apps| MicrosoftDocs"
33
description: Includes description and supported parameters for the form OnSave event.
4-
ms.date: 05/05/2021
4+
ms.date: 12/16/2021
55
ms.service: powerapps
66
ms.topic: "reference"
77
applies_to: "Dynamics 365 (online)"
@@ -34,9 +34,7 @@ You can cancel the save action by using the preventDefault method within the eve
3434

3535
The OnSave event has ability to wait for promises returned by event handlers to settle before saving, allowing the `OnSave` event to be asynchronous ("async").
3636

37-
The `OnSave` event becomes async when a promise is returned by an `OnSave` event handler, async OnSave events are enabled by default, if you wish to disable async operations for your `OnSave` handlers, go to [PowerApps](https://powerapps.microsoft.com), select **Solutions** tab , select the solution that has the app and then select **Settings**, and look for “Async onsave handler”, make sure the check box is unchecked. After disabling the option make sure you publish customizations.
38-
39-
Saving of the record happens when each promise returned by a handler is resolved. For any promises that are returned, there is a 10-second limit for each promise, after that the platform considers promises to be timed out. This timeout is applied per promise. For example, if we have five promises returned, the total wait time is 50 seconds.
37+
The `OnSave` event becomes async when a promise is returned by an `OnSave` event handler. Saving of the record happens when each promise returned by a handler is resolved. For any promises that are returned, there is a 10 second limit for each promise, after that the platform considers promises to be timed out. This timeout is applied per promise. For example, if we have 5 promises returned, the total wait time is 50 seconds.
4038

4139
If the promise is rejected or timed out, the save operation continues to behave similarly to the current script errors. Use the [preventDefault](../save-event-arguments/preventDefault.md) method within the event arguments object in that particular handler if you want to prevent the save event to happen if there is a script error/rejected promise or handler times out.
4240

@@ -62,39 +60,30 @@ In this scenario, since there are multiple async processes and both calls return
6260
> }
6361
>```
6462
65-
### Disable Async OnSave using app setting
66-
67-
An app setting is a platform component that allows you to override a setting on an app. App setting should have a unique name and must be in the format `solutionpublisherprefix_appname_settingname`.
68-
69-
To disable the async `OnSave` event handlers for a specific app:
70-
71-
- Create a new unmanaged solution.
72-
- Open the newly created solution. Select **Add existing** > **App** > **Model-driven app**.
73-
- From the list of existing model-driven apps, select the app where you want to see this feature.
74-
- Publish all customizations.
75-
- Again from the list of solutions in the solution explorer, select the solution where you have added the model-driven app and then select **Export**. A zip file is downloaded to your local machine.
76-
- Extract the downloaded zip file. Open the **Customizations.xml** file in your preferred editing tool.
77-
- Add the following code `AppModule` node in the `customization.xml` file. Setting the `<value>false</value>` to disable async `OnSave` event handler support for that specific app. Any form within this app will be able to get access to the async OnSave functionality.
78-
79-
```XML
80-
<appsettings>
81-
<appsetting uniquename="MyAppName_AsyncOnSave">
82-
<iscustomizable>1</iscustomizable>
83-
<settingdefinitionid>
84-
<uniquename>AsyncOnSave</uniquename>
85-
</settingdefinitionid>
86-
<value>true</value>
87-
</appsetting>
88-
</appsettings>
89-
```
90-
91-
- You can verify whether the configuration has been successfully installed using the following request:
92-
93-
```http
94-
GET https://org00000000.crm.dynamics.com/api/data/v9.2/appsettings?$filter=(uniquename eq 'MyAppName_AsyncOnSave')
95-
Accept: application/json
96-
Authorization: Bearer ey...
97-
```
63+
### Enable Async OnSave using app setting
64+
65+
To use async onSave handlers you will need to enable it through an app setting:
66+
67+
1. Go to https://make.powerapps.com.
68+
2. Make sure select the correct environment.
69+
3. Select **Apps** from the left navigation pane.
70+
4. Select the app and then select **...** (ellipses). Select **Open in preview**.
71+
5. Select **Settings** from the command bar.
72+
6. When the dialog opens, select **Features**.
73+
7. Turn on **Async onload handler**.
74+
8. Select **Save**.
75+
76+
![Async OnSave app setting](../../../media/async_onSave_app_settings.png "Async OnSave app setting")
77+
78+
### Async onSave timeouts
79+
80+
When using an async save the handler will wait for the promise to be fulfilled. To ensure that a save completes in a timely manner the handler throws a timeout exception after 10 seconds to let you know to tune the async `OnSave` event for better performance.
81+
82+
There may be scenarios where you want to halt the `OnSave` execution, and the timeout will stop the operation from occurring. An example is opening a dialog in the async OnLoad and waiting for the user’s input before saving. To make sure the async operation will wait you can provide the event argument **disableAsyncTimeout**(executioncontext.getEventArgs().disableAsyncTimeout()).
83+
84+
When the **disableAsyncTimeout is set, the timeout for that handler will not be applied. It will continue to wait for that handler's promise to be fulfilled.
85+
86+
This should be used with caution as it might affect the performance of the form save.
9887
9988
### Related article
10089
Loading
Loading

powerapps-docs/maker/data-platform/azure-synapse-link-solution.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ ms.topic: "conceptual"
1111
applies_to:
1212
- "powerapps"
1313
author: "sama-zaki"
14-
ms.assetid:
14+
ms.assetid:
15+
keywords: transporting; azure synapse link configuration
1516
ms.subservice: dataverse-maker
1617
ms.author: "matp"
1718
manager: "kvivek"

powerapps-docs/user/relevance-search.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ manager: kvivek
66
ms.service: powerapps
77
ms.component: pa-user
88
ms.topic: conceptual
9-
ms.date: 10/25/2021
9+
ms.date: 12/16/2021
1010
ms.subservice: end-user
1111
ms.author: mkaur
1212
ms.custom: ""
@@ -66,7 +66,7 @@ With suggestions, you can access your information quickly by using minimal keyst
6666

6767
## Search results page
6868

69-
View the full results for a search by pressing **Enter** on your keyboard or selecting **Show more results**.
69+
View the full results for a search by pressing **Enter** on your keyboard or selecting **Show more results**. Dataverse search will append "\*" to the search if two or less characters are entered.
7070

7171
Search results are ranked based on relevance and grouped by tables. The list of tables that include rows that match the search term are displayed horizontally as tabs along the top of the screen.
7272

0 commit comments

Comments
 (0)