Today, when I was Testing a feature in the Test Environment, found the below strange error in the Test environment and in the Dev environment there is no such issue in the code.
ReferenceError: Web resource method does not exist: XYZ.Case.OnLoad. However the closest object we found is XYZ.Case that contains these properties: GetEnvironmentVariableValue,SwitchBPF,OnPostSave. Please verify this object is not corrupt and is not an object of the same name defined elsewhere, such as another script.
at y._handleMethodNotExistError (https://Xyz-cep-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:14:1218209)
at y.execute (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:14:1216797)
at https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:4:108242
at i (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:14:102724)
at ne._executeIndividualEvent (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:4:108216)
at ne._executeEventHandler (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:4:105034)
at Object.execute (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:4:102225)
at w._executeSyncAction (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:14:587365)
at w._executeSync (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:14:587092)
at w.executeAction (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:14:586874)
at t.dispatch (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:14:592211)
at Object.dispatch (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:14:853204)
at Object.dispatch (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:14:591700)
at dispatch (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/app.js?v=1.4.6623-2310.3:14:587908)
at Ft (https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/20.js?v=1.4.6623-2310.3:4:55315)
at https://xyz-ce-test.crm6.dynamics.com/uclient/scripts/26.js?v=1.4.6623-2310.3:4:59919
Error Details:
Event Name: onload
Function Name: XYZ.Case.OnLoad
Web Resource Name: xyz_ce/incident.js
Solution Name: XYZBaseSolution
Publisher Name: xyz
I did the below things to troubleshoot this issue,
- Removed the Browser Cache.
- Checked for any Unmanaged layer on the JavaScript, which is causing this issue.
- Checked for any Unmanaged layer on the Case Form, where the code is running.
- Compared the Dev and Test Js Code.
And everything was looking good and nothing changed, but still issue was coming in Test.
Finally, I have opened the Case Form and clicked on the custom method configured on On Load Event, there was strange error message (some out of the box Read error message and some how, this file has corrupted.) and due to this script was not running as expected in the Test environment.
Removed the custom method which was giving the Read error on click of it, configured on On Load. Clicked on Save and Publish.
Added the same method back again to the On Load Event and clicked on Save and Publish, and deleted the browser cache and it started working without any issue.
Only thing to remember is needed to remove the Unmanaged layer on the form in the Test environment, before the next deployment to Test.
Hope you have followed my article and resolved this issue.
Please like and share your valuable feedback on this blog.