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: support/dynamics-365/field-service/scheduling/missing-form-context-bookable-resource.md
+240-5Lines changed: 240 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,19 +9,19 @@ ms.custom: sap:Schedule Board
9
9
---
10
10
#
11
11
12
-
This article helps resolve issues ........ in Microsoft Dynamics 365 Field Service.
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.
13
13
14
14
## Symptoms
15
15
16
16
When opening the form to create a bookable resource, the error message **Cannot read properties of undefined (reading 'getFormContext')** appears when selecting a user from the field.
17
17
18
18
## Cause
19
19
20
-
There was a change in the internal handler for the userID field. It now requires a context to be passed in from the form.
20
+
The system uses a customized form that is based on an old version of the bookable resource form. There was a change in the internal handlers for *onchange* events. They require the execution context to be passed in from the form.
21
21
22
22
## Resolution
23
23
24
-
You can fix this through an update of the form settings in Power Apps or with a script that you run in the browser's console.
24
+
You can address such isuses through Power Apps, by editing the form definitions of the customized forms in the corresponding customizations.xml file, or by running a script in the browser console to update the onchange event. The following resolutions assume that the script error references the function Mscrm.userid_onchange. If the error shows on other fields and references other functions, adapt the resolution steps to these fuctions.
25
25
26
26
### Update the form in Power Apps
27
27
@@ -44,5 +44,240 @@ You can fix this through an update of the form settings in Power Apps or with a
44
44
45
45
1. Save and publish the updated form.
46
46
47
-
Edit the handler and make sure that the "Pass execution context as first parameter" is checked
48
-
Save and publish the form
47
+
### Update the customizations.xml file
48
+
49
+
1. Open the customizations.xml file in an editor.
50
+
51
+
1. In the *Handler* element of the *Mscrm.userid_onchange* function, ensure that the *passExecutionContext* attribute is set to **true**.
52
+
53
+
### Run a script in the browser console
54
+
55
+
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.
56
+
57
+
1. Open the environment in your browser. The following steps describe how to run the script in Microsoft Edge.
58
+
59
+
1. Open **DevTools** by pressing F12 or by selecting the ellipsis (…) > **More tools** > **Developer tools**
60
+
61
+
1. In **DevTools**, select the **Console** tab and select **Clear Console**.
62
+
63
+
1. Copy and paste the code below into the console window.
64
+
65
+
1. Update the ORG constant to the URL for the environment.
66
+
67
+
1. Run the code and review the script output.
68
+
69
+
```JavaScript
70
+
constORG="<YOUR-ENVIRONMENT-URL>"; // for example "contoso.crm.dynamics.com"
71
+
72
+
asyncfunctionfixBookableResourceForms() {
73
+
74
+
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...`);
0 commit comments