unable to get Data of active record on section page

HI team,

 

I want to filter the Action option based on 3 conditions and I implemented it on the trial instance, it was working as expected using the below code.

 

But when we moved it to the Local Development environment then we are not getting the desired output 

when I checked we are getting Activerowid only on local development instance

 

var status=selectedOrder.get("UsrPOStatusNew");
              var statusordertype=selectedOrder.get("UsrOrderType");
              var vendorcode=selectedOrder.get("UsrVendorGSTStateCode");
               var statecode=selectedOrder.get("UsrBillToGSTStateCode");

 

these fields return an empty or undefined value 

Someone please suggest a solution or workaround

 

Thanks a lot 

 

 

define("UsrCondition631066a3Section", ["ProcessModuleUtilities"], function(ProcessModuleUtilities) {
    return {
        entitySchemaName: "UsrCondition",
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
        diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
        methods: {
          
           isRunning: function(activeRowId) {
                // Getting the section list view data collection. 
                var gridData = this.get("GridData");
             var selectedOrder = gridData.get(activeRowId);
                // Getting the selected order model accroding to the indicated primary column value. 
                var status=selectedOrder.get("UsrPOStatusNew");
              var statusordertype=selectedOrder.get("UsrOrderType");
              var vendorcode=selectedOrder.get("UsrVendorGSTStateCode");
               var statecode=selectedOrder.get("UsrBillToGSTStateCode");
             //this.showInformationDialog(status.displayValue);
             //this.showInformationDialog(statecode);
             this.showInformationDialog(status.displayValue);
             if(status.displayValue === "Approved" && statusordertype.displayValue==="Purchase Order" && vendorcode===statecode)
               {
                 return true;
               }
             else
               
                return false;
            },
          
           isRunning1: function(activeRowId) {
                // Getting the section list view data collection. 
                var gridData = this.get("GridData");
             var selectedOrder = gridData.get(activeRowId);
                // Getting the selected order model accroding to the indicated primary column value. 
                var status=selectedOrder.get("UsrPOStatusNew");
              var statusordertype=selectedOrder.get("UsrOrderType");
              var vendorcode=selectedOrder.get("UsrVendorGSTStateCode");
               var statecode=selectedOrder.get("UsrBillToGSTStateCode");
             //this.showInformationDialog(status.displayValue);
             //this.showInformationDialog(statecode);
             if(status.displayValue === "Approved" && statusordertype.displayValue==="Purchase Order" && vendorcode!==statecode)
               {
                 return true;
               }
             else
               
                return false;
            },
          isRunning2: function(activeRowId) {
                // Getting the section list view data collection. 
                var gridData = this.get("GridData");
             var selectedOrder = gridData.get(activeRowId);
                // Getting the selected order model accroding to the indicated primary column value. 
                var status=selectedOrder.get("UsrPOStatusNew");
              var statusordertype=selectedOrder.get("UsrOrderType");
              var vendorcode=selectedOrder.get("UsrVendorGSTStateCode");
               var statecode=selectedOrder.get("UsrBillToGSTStateCode");
             //this.showInformationDialog(status.displayValue);
             //this.showInformationDialog(statecode);
             if(status.displayValue === "Approved" && statusordertype.displayValue==="Work Order" && vendorcode!==statecode)
               {
                 return true;
               }
             else
               
                return false;
            },
          isRunning3: function(activeRowId) {
                // Getting the section list view data collection. 
                var gridData = this.get("GridData");
             var selectedOrder = gridData.get(activeRowId);
                // Getting the selected order model accroding to the indicated primary column value. 
                var status=selectedOrder.get("UsrPOStatusNew");
              var statusordertype=selectedOrder.get("UsrOrderType");
              var vendorcode=selectedOrder.get("UsrVendorGSTStateCode");
               var statecode=selectedOrder.get("UsrBillToGSTStateCode");
             //this.showInformationDialog(status.displayValue);
             //this.showInformationDialog(statecode);
             if(status.displayValue === "Approved" && statusordertype.displayValue==="Work Order" && vendorcode===statecode)
               {
                 return true;
               }
             else
               
                return false;
            },
          
            // Determines if the menu option is enabled. 
            isCustomActionEnabled: function() {
                // Attempt of getting the active (list selected) record identifier. 
                var activeRowId = this.get("ActiveRow");
              
                // If the identifier is determined and the order status is 
                // [In Progress], it gets true, otherwise - it gets false.
                return activeRowId ? this.isRunning(activeRowId) : false;
            },
             isCustomActionEnabled1: function() {
                // Attempt of getting the active (list selected) record identifier. 
                var activeRowId = this.get("ActiveRow");
              
                // If the identifier is determined and the order status is 
                // [In Progress], it gets true, otherwise - it gets false.
                return activeRowId ? this.isRunning1(activeRowId) : false;
            },
          isCustomActionEnabled2: function() {
                // Attempt of getting the active (list selected) record identifier. 
                var activeRowId = this.get("ActiveRow");
              
                // If the identifier is determined and the order status is 
                // [In Progress], it gets true, otherwise - it gets false.
                return activeRowId ? this.isRunning2(activeRowId) : false;
            },
          isCustomActionEnabled3: function() {
                // Attempt of getting the active (list selected) record identifier. 
                var activeRowId = this.get("ActiveRow");
              
                // If the identifier is determined and the order status is 
                // [In Progress], it gets true, otherwise - it gets false.
                return activeRowId ? this.isRunning3(activeRowId) : false;
            },
            // Action handler method. Displays the order creation date in the message window. 
            showOrderInfo: function() {
                var activeRowId = this.get("ActiveRow");
                var gridData = this.get("GridData");
                // Getting the order creation date. The column must be added to the list. 
               // var dueDate = gridData.get(activeRowId).get("Date");
                // Message window display.
                //this.showInformationDialog("hello");
              
                var args = {
        // Name of the process that should be run.
                 sysProcessName: "UsrProcess_44f0ffe",
                parameters:
                {
                  ProcessSchemaParameter1 : activeRowId
                 }
        // Object with the value of ContractParameter input parameter for CustomProcess parameter.
               };
              //this.showInformationDialog("hello1");
        // Running of user business process.
             ProcessModuleUtilities.executeProcess(args);
              //this.showInformationDialog("hello2");
              
              
            },
            // 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.purchaseActionCaptionIGST"},
                    // Action handler method linking. 
                    "Click": {bindTo: "showOrderInfo"},
                    // Linking of the menu option enabling property to the value that gets the isCustomActionEnabled method.
                    "Enabled": {bindTo: "isCustomActionEnabled"},
                   "Visible": {bindTo: "isCustomActionEnabled"}
                }));
               actionMenuItems.addItem(this.getButtonMenuItem({
                    // Linking the menu option title to the schema localized string.
                    "Caption": {bindTo: "Resources.Strings.purchaseActionCaptionCGSTSGST"},
                    // Action handler method linking. 
                    "Click": {bindTo: "showOrderInfo"},
                    // Linking of the menu option enabling property to the value that gets the isCustomActionEnabled method.
                    "Enabled": {bindTo: "isCustomActionEnabled1"},
                 "Visible": {bindTo: "isCustomActionEnabled1"}
                }));
               actionMenuItems.addItem(this.getButtonMenuItem({
                    // Linking the menu option title to the schema localized string.
                    "Caption": {bindTo: "Resources.Strings.WorkActionCaptionCGSTSGST"},
                    // Action handler method linking. 
                    "Click": {bindTo: "showOrderInfo"},
                    // Linking of the menu option enabling property to the value that gets the isCustomActionEnabled method.
                    "Enabled": {bindTo: "isCustomActionEnabled2"},
                 "Visible": {bindTo: "isCustomActionEnabled2"}
                }));
               actionMenuItems.addItem(this.getButtonMenuItem({
                    // Linking the menu option title to the schema localized string.
                    "Caption": {bindTo: "Resources.Strings.WorkActionCaptionIGST"},
                    // Action handler method linking. 
                    "Click": {bindTo: "showOrderInfo"},
                    // Linking of the menu option enabling property to the value that gets the isCustomActionEnabled method.
                    "Enabled": {bindTo: "isCustomActionEnabled3"},
                     "Visible": {bindTo: "isCustomActionEnabled3"}
                }));
                // Getting the appended section action collection.
                return actionMenuItems;
            }
          
        }
    };
});
 

Like 1

Like

2 comments
Best reply

The difference between your trial and your local instance (and why it isn't working in your local instance) is likely because of a difference in the section list layout (the columns added to the list). In order for a field you're using to be available as a part of GridData, it needs to exist in the ESQ behind the list, meaning it needs to be in the column layout - or you need to add the column to the list ESQ. For example, you're using the column "UsrPOStatusNew" from the GridData. If the UsrPOStatusNew column doesn't exist in the list ESQ (which it only will if it's in the column layout for the list), it won't be available. You can add this column and any other column you'll need to access in the section code by adding it to the list ESQ like this:

initQueryColumns: function(esq) {
    this.callParent(arguments);
 
    if (!esq.columns.contains("UsrPOStatusNew")) {
        esq.addColumn("UsrPOStatusNew");
    }
}

Now, when you need to access the UsrPOStatusNew column, it will be available in the GridData. I picked UsrPOStatusNew out of your code as an example, add any other fields you'll need to access in the section code using the same as above.

Ryan

The difference between your trial and your local instance (and why it isn't working in your local instance) is likely because of a difference in the section list layout (the columns added to the list). In order for a field you're using to be available as a part of GridData, it needs to exist in the ESQ behind the list, meaning it needs to be in the column layout - or you need to add the column to the list ESQ. For example, you're using the column "UsrPOStatusNew" from the GridData. If the UsrPOStatusNew column doesn't exist in the list ESQ (which it only will if it's in the column layout for the list), it won't be available. You can add this column and any other column you'll need to access in the section code by adding it to the list ESQ like this:

initQueryColumns: function(esq) {
    this.callParent(arguments);
 
    if (!esq.columns.contains("UsrPOStatusNew")) {
        esq.addColumn("UsrPOStatusNew");
    }
}

Now, when you need to access the UsrPOStatusNew column, it will be available in the GridData. I picked UsrPOStatusNew out of your code as an example, add any other fields you'll need to access in the section code using the same as above.

Ryan

Ryan Farley,

 

Thank You very Much ?

Show all comments