Hi,
I'm having a problem with my custom form for a solution I've built for Dynamics 9.1 (on-premises).
When I click the new Quote button on the Quotes grid on the Opportunity form, I am navigated to the Quote page and I immediately get an error popup stating "Cannot read properties of undefined (reading 'Tabs')"
After some investigation, this seems to be a problem with the order in which my Web Resources in my solution are being loaded into the browser for the form I have created.
There are 2 scripts in play here: (I'm simplifying the names of them slightly for this post)
Quote.Components.js
Quote.RibbonEvents.js
Quote.Components.js is a simple file that holds some constants for the names of the tabs, fields etc being used on that form for multiple scripts to have access to and being a centralised place I can keep those variables.
Quote.RibbonEvents.js has a few functions, including one being used for an enableRule I have configured for a button using the Ribbon Workbench. It has a dependency on Quote.Components.js as it uses some of the constants stored in it.
While debugging this in the browser I hit a breakpoint where the error is caught in Quote.RibbonEvents.js, I can see that it's because the QuoteComponents variable (set by Quote.Components.js) is undefined because that script has not been loaded by the time this enable rule is being fired.
I have tried several things to resolve this, including ensuring Quote.Components.js is at the top of the list of the form libraries for the scripts being used on the form, and also setting Quote.Components.js as a dependency of Quote.RibbonEvents.js within the solution. However, Dynamics still seems to fire the enable rule before the dependency is loaded.
Does anyone have any other ideas I can try or any pointers/suggestions for me? Anything would be greatly appreciated.
Cheers,
Tom.