Hello, I'm using the N/query module to groupBy &a...
# suitescript
s
Hello, I'm using the N/query module to groupBy & sum; however, I can't seem to leverage the API to query.sort my grouped results. Any suggestions?
Copy code
//Add Account Query for Grouping
          var accountQuery = query.create({
              type: 'customrecord_payments',
              columns: [

                    {fieldId: 'custrecord_account',
                     context: {
                       name: query.FieldContext.DISPLAY
                     },
                     groupBy: true
                    },
                	{fieldId: 'custrecord_pay_type',
                       context: {
                          name: query.FieldContext.DISPLAY
                       },
                     groupBy: true
                    },

                    {fieldId: 'custrecord_pay_amount',
                     aggregate: query.Aggregate.SUM
                    }
              ]
            });

           accountQuery.sort = [
               accountQuery.createSort({
               column: accountQuery.columns[0]
            }),
            accountQuery.createSort({
               column: accountQuery.columns[1],
            })
          ];