Skip to content

Commit fc86406

Browse files
authored
Update grid-onrecordselect.md
Simplified the steps to create a web resource and reference existing doc
1 parent 73532e6 commit fc86406

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

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

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,12 @@ contributors:
1616

1717
The `OnRecordSelect` event occurs when a single row (record) is selected in the editable grid. This event won't occur if a user selects different cells in the same row, or selects multiple rows.
1818

19-
## Override the default open behavior in model-driven grids
19+
## Example: Override the default open behavior in model-driven grids
2020
There might be situations where you don't want the table record to open (which is the default behavior), but want a custom action to be performed such as opening a URL using JavaScript functions. Here is an example to acheive this using the [Power Apps Grid Control](../../../../../maker/model-driven-apps/the-power-apps-grid-control) and the `OnRecordSelect` event.
2121

2222
### Step 1: Create a web resource
2323

24-
Create a web resource to change the default behavior. In the following example, if you want to open a URL instead of displaying the record, you create a JavaScript web resource to perform that action.
25-
26-
1. Sign in to [Power Apps](https://make.powerapps.com) and select **Solutions** from the left pane.
27-
28-
2. Select **New solution**, and then complete the required columns for the solution.
29-
30-
|Column|Description|
31-
|-----------|-----------------|
32-
|**Display Name**|The name shown in the list of solutions. You can change this later.|
33-
|**Name**|The unique name of the solution. This is generated by using the value you enter in the **Display Name** column. You can edit this before you save the solution, but after you save the solution, you can't change it.|
34-
|**Publisher**|You can select the default publisher or create a new publisher. We recommend that you create a publisher for your organization to use consistently across the environments where you'll use the solution.|
35-
|**Version**|Enter a number for the version of your solution. This is only important if you export your solution. The version number will be included in the file name when you export the solution.|
36-
37-
3. Select **Save**.
38-
39-
4. Open the solution, and then select **New** > **Other** > **Web resource**.
40-
41-
5. Enter the name of the web resource, and select the **Type** as **JavaScript (JS)**.
42-
43-
6. Select **Text Editor**, copy the code shown below, paste it into the text editor. This example uses the **contact** table. Set the `entityName` to the table you want.
24+
Create, save and publish a JavaScript (JS) web resource that contains the following code. This example uses **contact** table. Set the `entityName` you want to use.
4425

4526
```JavaScript
4627
function OnSelect(context) {
@@ -52,7 +33,8 @@ Create a web resource to change the default behavior. In the following example,
5233
Xrm.Navigation.navigateTo(pageInput);
5334
}
5435
```
55-
7. Save and publish the web resource.
36+
37+
More information: [Create or edit model-driven app web resources ](../../../../../maker/model-driven-apps/create-edit-web-resources.md)
5638

5739
### Step 2: Enable Power Apps Grid Control
5840
Follow these steps to enable the **Power Apps Grid Control** as the main grid (table view) or within a model-driven form subgrid.
@@ -64,7 +46,7 @@ Follow these steps to enable the **Power Apps Grid Control** as the main grid (t
6446
When enabling the **Power Apps Grid Control**, an **Events** tab appears. Select the **Events** tab:
6547
1. Under the **Form Libraries** section, add the Form Libary from the web resource just created.
6648
2. Under the **Event Handlers** section, select the event **OnRecordSelect** and click Add, a popup will appear.
67-
3. In the popup, select the form library just added and the Function name **OnSelect**. This is the name of the JavaScript function created in the web resource, and check the option **Pass execution context as first parameter**.
49+
3. In the popup, select the form library just added and the Function name **OnSelect**. This is the name of the JavaScript function created in the web resource, and make sure to check the option **Pass execution context as first parameter**.
6850

6951

7052
For more infomation, see [Power Apps Grid Control](../../../../../maker/model-driven-apps/the-power-apps-grid-control)

0 commit comments

Comments
 (0)