Custom 'Action' menu item only showing on browser cache refresh
This is code from the Develop your first application tutorial in the developer documentation.
An 'Action' menu item is set up in the client module of the section edit page:
/* Add the action to the action menu. */ getActions: function() { var actionMenuItems = this.callParent(arguments); actionMenuItems.addItem(this.getButtonMenuItem({ "Caption": {bindTo: "Resources.Strings.AddTrainingsActionCaption"}, /* Define the handler method for the action. */ "Click": {bindTo: "getBusinessProcessAddTrainings"}, "Enabled": true })); return actionMenuItems; },
The menu option however only shows when the browser cache has been refreshed. It happens every time an edit page is opened for a record (not just the first time an edit page is opened). There initially is a blank space where the menu item should be, after a refresh the menu item shows. There are some errors in the console:
When the page is loaded...
all-combined.js:41 The Id column is not declared in the ViewModel of the menu item
When the initial blank menu item is clicked:
Uncaught TypeError: Cannot read properties of undefined (reading 'apply') at i.callModelMethod (all-combined.js:41) at i.<anonymous> (all-combined.js:41) at i.fire (all-combined.js:6) at i.continueFireEvent (all-combined.js:6) at i.fireEventArgs (all-combined.js:6) at i.fireEvent (all-combined.js:6) at i.onClick (all-combined.js:41) at HTMLLIElement.eval (eval at cacheableFunctionFactory (all-combined.js:6), <anonymous>:6:13) at HTMLLIElement.k (all-combined.js:6) at t.value (polyfills-es5.js?hash=96751a9859cf44a7a1eb788f80c32556:1) user: XXXX XXXX /268b5da7-2ede-4b32-8bbe-9af04721ebba file: https://110816-crm-bundle.creatio.com/core/83382b3fa36e6adf19d56492fa6ed49d/ng-core/src/polyfills-es5.js?hash=96751a9859cf44a7a1eb788f80c32556 line: 1 column: 16702 message: Uncaught TypeError: Cannot read properties of undefined (reading 'apply') date: Fri Dec 24 2021 14:10:31 GMT+0000 (Greenwich Mean Time) stack: TypeError: Cannot read properties of undefined (reading 'apply') at i.callModelMethod
Like
Hello Gareth,
Thank you for your comments, we have tried to re-create the issue from our side and noticed that few more correction should be applied to the instruction even in previous steps of the article.
We are currently working on correcting the mentioned article, once done it will be available again and no issues should occur while following the instruction.
Thank you for understanding and helping us to make our application better.
Best regards,
Anastasiia