You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/model-driven-apps/clientapi/navigate-to-custom-page-examples.md
+68-10Lines changed: 68 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,7 @@
1
1
---
2
2
title: "Navigating to and from a custom page in your model-driven app using client API (preview)"
3
-
description: "This article provides examples of navigating from a model-driven app page using the Client API to a custom page."
4
-
ms.custom: ""
5
-
ms.date: 07/21/2021
3
+
description: "This article provides examples of navigating from a model-driven app page using the client API to a custom page."
4
+
ms.date: 08/17/2021
6
5
ms.reviewer: ""
7
6
ms.service: powerapps
8
7
ms.subservice: mda-developer
@@ -24,7 +23,7 @@ search.app:
24
23
25
24
This article provides examples of navigating from a model-driven app page to a custom page using [Client API](../client-scripting.md). This article also includes examples of navigating from a custom page to other custom pages and also from custom page to model-driven app form.
26
25
27
-
This article outlines the steps to use Client API to open a custom page as a full-page, dialog, or pane. It provides examples of **custom** as a `pageType` value in [navigateTo (Client API reference)](reference/xrm-navigation/navigateto.md).
26
+
This article outlines the steps to use client API to open a custom page as a full-page, dialog, or pane. It provides examples of **custom** as a `pageType` value in [navigateTo (Client API reference)](reference/xrm-navigation/navigateto.md).
28
27
29
28
> [!IMPORTANT]
30
29
> - This is a preview feature, and isn't available in all regions.
@@ -35,13 +34,13 @@ This article outlines the steps to use Client API to open a custom page as a ful
35
34
36
35
### Finding the logical name
37
36
38
-
Each of the following Client API examples takes the logical name of the custom page as the required parameter. The logical name is the **Name** value of the page in the solution explorer.
37
+
Each of the following client API examples takes the logical name of the custom page as the required parameter. The logical name is the **Name** value of the page in the solution explorer.
Within a model-driven app Client API event handler, call the following code and update the **name** parameter to be the logical name of the custom page. This mode supports the sizing parameters similar to the [Main form dialogs](../../../developer/model-driven-apps/customize-entity-forms.md#open-main-form-in-a-dialog-using-client-api).
95
+
Within a model-driven app client API event handler, call the following code and update the **name** parameter to be the logical name of the custom page. This mode supports the sizing parameters similar to the [Main form dialogs](../../../developer/model-driven-apps/customize-entity-forms.md#open-main-form-in-a-dialog-using-client-api).
Within a model-driven app Client API event handler, call the following code and update the **name** parameter to be the logical name of the custom page.
123
+
Within a model-driven app client API event handler, call the following code and update the **name** parameter to be the logical name of the custom page.
125
124
126
125
```javascript
127
126
// Side Dialog
@@ -201,7 +200,66 @@ This example uses the `recordId` parameter within the [navigateTo](reference/Xrm
201
200
```
202
201
203
202
> [!NOTE]
204
-
> After changing the `OnStart` property, you'll need to run `OnStart` from the App context menu. This function runs only once within a session.
203
+
> After changing the `OnStart` property, you'll need to run `OnStart` from the App context menu. This function performs only once within a session.
204
+
205
+
1. Then, the custom page can use the **RecordItem** parameter as a record. Below is an example on how to use it in an [EditForm](../../../maker/canvas-apps/functions/function-form.md).
206
+
207
+
```powerappsfl
208
+
EditForm.Datasource=<datasource name>
209
+
EditForm.Item=RecordItem
210
+
```
211
+
212
+
### Open from a selected record in editable grid as a centered dialog with record ID
213
+
214
+
Editable grid can be used to trigger [OnRecordSelect](reference/events/grid-onrecordselect.md) event for scenarios where you want to perform an action when a particular record is selected in a view. This example uses the `recordId` parameter within the [navigateTo](reference/Xrm-Navigation/navigateTo.md) function to provide the custom page with the record to use. The record ID is retrieved using the `getId` method in [GridEntity](reference/grids/gridentity.md) object. The `Param` function within the custom page retrieves the value and uses the lookup function to retrieve the record.
215
+
216
+
1. [Enable editable grid](../../../developer/model-driven-apps/use-editable-grids.md) control in the table.
217
+
218
+
1. Create a web resource of type **JScript** and update the **name** parameter to be the logical page name. Add the following code to the web resource.
219
+
220
+
```javascript
221
+
function RunOnSelected(executionContext) {
222
+
// Retrieves the record selected in the editable grid
223
+
var selectedRecord =executionContext.getFormContext().data.entity;
224
+
var Id =selectedRecord.getId().replace(/[{}]/g, "");
> After changing the `OnStart` property, you'll need to run `OnStart` from the App context menu. Thisfunction performs only once within a session.
205
263
206
264
1. Then, the custom page can use the **RecordItem** parameter as a record. Below is how to use it in an [EditForm](../../../maker/canvas-apps/functions/function-form.md).
207
265
@@ -225,5 +283,5 @@ This example uses the `recordId` parameter within the [navigateTo](reference/Xrm
225
283
226
284
[Add a custom page to your model-driven app](../../../maker/model-driven-apps/add-page-to-model-app.md)
227
285
228
-
[navigateTo (Client API reference)](reference/xrm-navigation/navigateto.md)
286
+
[navigateTo (client API reference)](reference/xrm-navigation/navigateto.md)
Copy file name to clipboardExpand all lines: powerapps-docs/maker/canvas-apps/create-component.md
+28-9Lines changed: 28 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: hemantgaur
5
5
ms.service: powerapps
6
6
ms.subservice: canvas-developer
7
7
ms.topic: article
8
-
ms.date: 07/01/2021
8
+
ms.date: 08/18/2021
9
9
ms.author: hemantg
10
10
ms.reviewer: tapanm
11
11
search.audienceType:
@@ -15,6 +15,7 @@ search.app:
15
15
contributors:
16
16
- hemantgaur
17
17
- tapanm-msft
18
+
- gregli-msft
18
19
---
19
20
20
21
# Create a component for canvas apps
@@ -45,13 +46,6 @@ Components available inside the app are listed under the **Custom** category in
45
46
> [!NOTE]
46
47
> Components discussed in this article are different from the Power Apps component framework that enables developers and makers to create code components for model-driven and canvas apps. For more information, go to [Power Apps component framework overview](../../developer/component-framework/overview.md).
47
48
48
-
## Scope
49
-
50
-
Think of a component as an encapsulated black box with properties as the interface. You can't access controls in the component from outside of the component. And you can't refer to anything outside of the component from inside the component. The exception is data sources shared between an app and its components. Scope restrictions keep the data contract of a component simple and cohesive, and it helps enable component-definition updates, especially across apps with component libraries. You can update the data contract of the component by creating one or more custom properties.
51
-
52
-
> [!NOTE]
53
-
> You can insert instances of components into a screen within a component library, and preview that screen for testing purposes. Also, note that the component library does not display when using [Power Apps Mobile](https://powerapps.microsoft.com/downloads/).
54
-
55
49
## Custom properties
56
50
57
51
A component can receive input values and emit data if you create one or more custom properties. These scenarios are advanced and require you to understand [formulas](formula-reference.md) and binding contracts.
@@ -187,6 +181,31 @@ So far, you've created a component and added it to an app. Next, you'll create a
187
181
188
182
The **Label** control reflects the menu item that you selected most recently.
189
183
184
+
## Scope
185
+
186
+
Input and output properties clearly define the interface between a component and its host app. By default, the component is encapsulated so that it's easier to reuse the component across apps, requiring the use of the properties to pass the information in and out of the component. Scope restrictions keep the data contract of a component simple and cohesive, and it helps enable component-definition updates—especially across apps with component libraries.
187
+
188
+
But there are times when a component may want to share a data source or a variable with its host. Especially when the component is only intended for use in one particular app. For these cases, you can directly access app level information by turning on the **Access app scope** switch in the component's property pane:
189
+
190
+

191
+
192
+
When **Access app scope** is turned on, the following are accessible from within a component:
193
+
194
+
- Global variables
195
+
- Collections
196
+
- Controls and components on screens, such as a TextInput control
197
+
- Tabular data sources, such as Dataverse tables
198
+
199
+
When this setting is turned Off, none of the above are available to the component. [**Set**](functions/function-set.md) and [**Collect**](functions/function-clear-collect-clearcollect.md) functions are still available but the resulting variables and collections are scoped to the component instance and not shared with the app.
200
+
201
+
Non-tabular data sources, such as Azure Blob Storage or a custom connector, are available whether this setting is turned on or off. Think of these data sources more like referencing an environment resource rather than an app resource. When a component is brought into an app from a component library, these data sources from the environment are also brought in.
202
+
203
+
Components in a component library can never have access to app scope, as there's no single app scope to refer to. So, this setting isn't available in this context, and is effectively off. Once imported into an app, and if customization was allowed by the component maker, the switch can be enabled, and the component can be modified to use the app scope.
204
+
205
+
> [!NOTE]
206
+
> - You can insert instances of components into a screen within a component library, and preview that screen for testing purposes.
207
+
> - Component library doesn't display when using [Power Apps Mobile](https://powerapps.microsoft.com/downloads/).
208
+
190
209
## Import and export components
191
210
192
211
> [!NOTE]
@@ -249,7 +268,7 @@ Once you save the app, you can reuse the components of this app using the same m
249
268
## Known limitations
250
269
251
270
- You can't save data sources, forms, and data tables with components.
252
-
- Collections in components are not supported.
271
+
- Collections in components aren't supported.
253
272
- You can't insert a component into a gallery or a form.
254
273
- A master instance of a component is a local master and scoped to the app. If you change a master instance, only copies of the component within the app will reflect the change. Copies in other apps will remain the same unless you import the component library again. All master instances in those apps will be automatically detected and updated.
255
274
- You can't package media files when you import a component.
0 commit comments