Skip to content

Commit a01e0c2

Browse files
authored
Update grid-onrecordselect.md
Tidied up the code get the navigateTo params from the execution context
1 parent 8004f6f commit a01e0c2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ There might be situations where you don't want the table record to open (which i
2121

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

24-
Create, save and publish a JavaScript (JS) web resource that contains the following code. This example uses **contact** table and a specific form. Set the `entityName` you want to use.
24+
Create, save and publish a JavaScript (JS) web resource that contains the following code. It automatically gets the entity name and entity ID from [execution context](power-apps/developer/model-driven-apps/clientapi/reference/execution-context).
2525

2626
```JavaScript
2727
var Example = window.Example || {};
2828
(function () {
2929
this.OnSelect = function (executionContext) {
3030
var pageInput = {
3131
pageType: "entityrecord",
32-
entityName: "contact",
33-
entityId: executionContext.getFormContext().data.entity.getId(),
32+
entityName: executionContext.getEventSource().getEntityName(),
33+
entityId: executionContext.getEventSource().getId(),
3434
formId: "420786E3-D342-4A9A-914B-AA331FF2D25E"
3535
};
3636
Xrm.Navigation.navigateTo(pageInput);

0 commit comments

Comments
 (0)