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
title: Missing form context for internal handlers on customized bookable resource forms
3
-
description: Address issues with customized forms based on the default bookable resource form for Dynamics 365 Field Service.
2
+
title: Missing Form Context for Internal Handlers on Customized Bookable Resource Forms
3
+
description: Addresses issues with customized forms that are based on the default bookable resource form for Dynamics 365 Field Service.
4
4
author: m-hartmann
5
5
ms.author: mhart
6
6
ms.reviewer: mhart
7
-
ms.date: 03/31/2025
7
+
ms.date: 04/08/2025
8
8
ms.custom: sap:Schedule Board
9
9
---
10
-
# Missing form context for internal handlers on customized bookable resource forms
10
+
# Form context for internal handlers is missing on customized bookable resource forms
11
11
12
-
This article helps resolve issues caused by missing form context for internal handlers on the bookable resource form in Microsoft Dynamics 365 Field Service.
12
+
This article helps resolve an issue caused by missing form context for internal handlers on bookable resource forms in Microsoft Dynamics 365 Field Service.
13
13
14
14
## Symptoms
15
15
16
-
When you select a user from the field on the form while [creating a bookable resource](/dynamics365/field-service/set-up-bookable-resources) in Dynamics 365 Field Service, you might receive the following error message:
16
+
While [creating a bookable resource](/dynamics365/field-service/set-up-bookable-resources) in Dynamics 365 Field Service, you might receive the following error message when you select a user from a field on the form:
17
17
18
18
> Cannot read properties of undefined (reading 'getFormContext')
19
19
20
20
## Cause
21
21
22
-
The issue occurs because the system uses a customized form based on an outdated version of the bookable resource form. A change in the internal handlers for `onchange` events now requires the execution context to be passed in from the form.
22
+
The issue occurs because the system uses a customized form that is based on an outdated version of the bookable resource form. A change to the internal handlers for `onchange` events now requires the execution context to be passed in from the form.
23
23
24
24
## Resolution
25
25
26
26
Use one of the listed resolutions to ensure that the execution context is passed as the first parameter.
27
27
28
28
> [!IMPORTANT]
29
-
> The following resolutions assume that the script error references the `Mscrm.userid_onchange` function. If the error refers to other fields or functions, such as `Mscrm.accountid_onchange` or `Mscrm.contactid_onchange`, adapt the steps accordingly.
29
+
> The following resolutions assume that the script error references the `Mscrm.userid_onchange` function. If the error refers to other fields or functions, such as `Mscrm.accountid_onchange` or `Mscrm.contactid_onchange`, adjust the steps accordingly.
30
30
31
31
### Resolution 1: Update the form in Power Apps
32
32
@@ -38,9 +38,9 @@ Use one of the listed resolutions to ensure that the execution context is passed
38
38
39
39
If the handler doesn't exist:
40
40
41
-
1. Add a new event of type **On Change**
41
+
1. Add a new event of type **On Change**.
42
42
1. Select the **Scheduling/BookableResource/BookableResource_main_system_library.js** library.
43
-
1. Enter _Mscrm.userid_onchange_ in the **Function** field.
43
+
1. Enter **Mscrm.userid_onchange** in the **Function** field.
44
44
1. Ensure the **Enabled** and **Pass execution context as first parameter** checkboxes are selected.
45
45
46
46
If the handler exists:
@@ -59,232 +59,232 @@ Use one of the listed resolutions to ensure that the execution context is passed
59
59
60
60
### Resolution 3: Run a script in the browser console
61
61
62
-
To ensure this script has the permission to find and update the required information, you need to run it in a browser tab that has an active session with your enviornment. Additionally, your user account needs the permisssions to update the XML of the customized bookable resource form.
62
+
To ensure this script has permission to find and update the required information, you need to run it in a browser tab that has an active session with your environment. Additionally, your user account needs permisssion to update the XML of the customized bookable resource form.
63
63
64
64
1. Open the environment in your browser. The following instructions use Microsoft Edge as an example.
65
65
66
-
1. Open **DevTools** by pressing F12 or navigating to ellipsis (…) > **More tools** > **Developer tools**
66
+
1. Open **DevTools** by pressing <kbd>F12</kbd> or navigating to ellipsis (…) > **More tools** > **Developer tools**.
67
67
68
-
1. Select the **Console** tab in the DevTools and select **Clear Console**.
68
+
1. Select the **Console** tab in DevTools and select **Clear Console**.
69
69
70
70
1. Copy and paste the following JavaScript code into the console.
71
71
72
-
1. Update the `ORG` constant in the script with your environment URL, for example, `contoso.crm.dynamics.com`.
73
-
74
-
1. Run the script and review the output to confirm the updates.
72
+
```JavaScript
73
+
constORG="<YOUR-ENVIRONMENT-URL>"; // for example "contoso.crm.dynamics.com"
75
74
76
-
```JavaScript
77
-
constORG="<YOUR-ENVIRONMENT-URL>"; // for example "contoso.crm.dynamics.com"
75
+
asyncfunctionfixBookableResourceForms() {
78
76
79
-
asyncfunctionfixBookableResourceForms() {
77
+
console.log("Starting Bookable Resource Form fetch process...");
80
78
81
-
console.log("Starting Bookable Resource Form fetch process...");
console.log(` Form ${form.name} (${form.formid}) has the Mscrm.userid_onchange event handler but the passExecutionContext attribute is not set to true. Setting it to true...`);
172
170
173
-
console.log(`Form ${form.name} (${form.formid}) has the Mscrm.userid_onchange event handler but the passExecutionContext attribute is not set to true. Setting it to true...`);
0 commit comments