Question

Issue with code validation when trying to replace client module

Hello, its my first time posting here. I'm hoping to certify myself in bpm online for work. I've been having problems with code validation when trying to replace a client module.

I've been receiving the error that: "Label 'isCustomActionEnabled' on function statement". I'm relatively new to JavaScript as well so that might be why I don't understand why this is happening. Is this not how function declaration works in JavaScript?

If anyone has any insight what I can do, I would really appreciate it. 

Thanks in advance!

Per

define("OrderSectionV2", ["OrderConfigurationConstants"],
        function(OrderConfigurationConstants) {
            return {
                // Section schema name.
                entitySchemaName: "Order",
                // Section view model methods. 
                methods: {
 
                    prepareResponseCollectionItem: function(item) {
                        // Calling the base method.
                        this.callParent(arguments);
                        item.customStyle = null;
                        // Determining the order status.
                        var running = item.get("Status");
                        //If the status of the order is "In progress", the record style changes.
                        if (running.value === OrderConfigurationConstants.Order.OrderStatus.Running) {
                            item.customStyle = {
                                // The text color is white.
                                "color": "white",
                                // The background color is green.
                                "background": "8ecb60"
                            };
                        }
                        // Determines if the menu option is enabled.
                        isCustomActionEnabled: function() {
                                // Attempt of getting the selected record identifier array. 
                                var selectedRows = this.get("SelectedRows");
                                // If the array contains any elements (at least one list record is selected),  
                                // it gets true, otherwise - it gets false.
                                return selectedRows ? (selectedRows.length > 0) : false;
                            },
                            // Action handler method. Displays the account list in the message window. 
                            showOrdersInfo: function() {
                                // Getting the selected record identifier array. 
                                var selectedRows = this.get("SelectedRows");
                                // Getting the list record data collection.
                                var gridData = this.get("GridData");
                                // Variable for stoarge of the selected order object model. 
                                var selectedOrder = null;
                                // Variable for stoarge of the selected order account name. 
                                var selectedOrderAccount = "";
                                // Variable for the message window text. 
                                var infoText = "";
                                // Handling of the selected section record identifier array.  
                                selectedRows.forEach(function(selectedRowId) {
                                    // Getting the selected order object model. 
                                    selectedOrder = gridData.get(selectedRowId);
                                    // Getting the selected order account name. The column must be added to the list. 
                                    selectedOrderAccount = selectedOrder.get("Account").displayValue;
                                    // Adding the account name to the message window text.
                                    infoText += "\n" + selectedOrderAccount;
                                });
                                // Message window display.
                                this.showInformationDialog(infoText);
                            },
                            // Overriding the base virtual method that gets the section action collection.
                            getSectionActions: function() {
                                // Calling of the method parent implementation for getting the
                                // initiated action collection of the section.
                                var actionMenuItems = this.callParent(arguments);
                                // Adding a separator line.
                                actionMenuItems.addItem(this.getButtonMenuItem({
                                    Type: "Terrasoft.MenuSeparator",
                                    Caption: ""
                                }));
                                // Adding a menu option to the section action list. 
                                actionMenuItems.addItem(this.getButtonMenuItem({
                                    // Linking the menu option title to the schema localized string.
                                    "Caption": {
                                        bindTo: "Resources.Strings.AccountsSectionAction"
                                    },
                                    // Action handler method linking. 
                                    "Click": {
                                        bindTo: "showOrdersInfo"
                                    },
                                    "Enabled": {
                                        bindTo: "isCustomActionEnabled"
                                    }
                                }));
                                // Getting the appended section action collection.
                                return actionMenuItems;
                            }
                    }
                };
            });

 

Like 0

Like

2 comments

Dear Per,

It seems you forgot to add one more curly brace and comma }, before isCustomActionEnabled function.

Peter Vdovukhin,

 That solved it :)  Completely forgot you needed to add a comma after each method unless its the last one. Thank you Peter!

Show all comments