Script Errors Encountered after Field Service Upgrade to 8.x


In one of my projects, I suddenly encountered script errors after upgrading the Field Service solution from version 7.x to 8.x (the latest version). When loading the Quote and Product line item forms, the system shows the following error message:

Script Error

One of the scripts for this record has caused an error. For more details, download the log file.
Web resource method does not exist: FS.Quote.Library.Load

Upon further investigation, I found that the Display Name of the Quote Library is empty in the Form Properties.


And when I clicked Edit on the Quote.Library.js, the content here is empty too. This is what caused the error message popping up every time the form is loaded. 

Solution: As suggested by Microsoft Support engineer, the solution is to
  • remove the deprecated/empty library (e.g. msdyn_/Quote/Quote.Library.js)
  • add the library found in the Field Service Information Form (i.e. msdyn_/Quote/FieldService.Quote.js)​
  • Add the event handler with the new Form OnLoad method (e.g. FieldService.Quote.Library.Load) and make sure that Pass execution context as first parameter is checked.​

Root Cause: During the Field Service upgrade, the upgrade process removed the old msdyn_/Quote/Quote.Library.js and replaced it with the new msdyn_/Quote/FieldService.Quote.js. But the process can only replace the library and the event handler method in the out-of-the-box Field Service Information forms, not in the custom forms copied from the Field Service Information forms.

Other affected areas

After closing that ticket with Microsoft Support, I realised that the same issue is happening in the Quote Product entity form too. I applied the same solution by checking the Library and Function from Field Service Information form and updated in the custom forms copied from the FS form.

Here is the list of other impacted custom Field Service forms that I had to change. There is no change required in the Field Service forms of Order Product and Opportunity entities.

Entity Logical Name Deprecated Library Deprecated Function New Library New Function
Quote quote msdyn_/Quote/Quote.Library.js FS.Quote.Library.Load msdyn_/Quote/FieldService.Quote.js FieldService.Quote.Library.Load
Quote Product quotedetail msdyn_/Quote/QuoteLine.Library.js FS.QuoteLine.Library.Load msdyn_/QuoteDetail/FieldService.QuoteDetail.js FieldService.QuoteDetail.Library.onLoad
Order salesorder msdyn_/Order/Order.Library.js FS.QuoteLine.Library.Load FS.Order.Library.Load FieldService.Order.Library.Load
Opportunity Line opportunityproduct msdyn_/Opportunity/OpportunityLine.Library.js FS.OpportunityLine.Library.Load msdyn_/OpportunityProduct/FieldService.OpportunityProduct.js FieldService.OpportunityProduct.Library.load


Summary

If we copy the out-of-the-box forms or views with scripts attached, we need to make sure that those copied components are working fine after every solution upgrade/service update just in case Microsoft deprecate the JavaScript libraries and replace with the new ones.

Comments

Popular Posts