I’m trying to build aggregate models dynamically, and I’m getting a VF remoting exception:
Field must be grouped or aggregated: Preliminary_AVR__c
As you can see in the code below, I’m trying to group on the Preliminary_AVR__c field, but apparently not?
Here’s the setup of the code:
getPrelimAVR: function(s,e,l,previous){<br> var model = new mm();<br> model.objectName = 'Patient_Case__c';<br> model.id = (previous ? 'Prev_': '') + 'PrelimAVR';<br> model.type = 'aggregate';<br> model.isAggregate = true;<br> model.fields = i<br> {id: 'Id', name: 'records', function:'COUNT_DISTINCT'},<br> {id: 'Preliminary_AVR__c', name: 'grouping', groupable: true}<br> ];<br> model.groupByFields = i<br> {id: 'Preliminary_AVR__c', name: 'grouping'}<br> ];<br> model.conditions = t<br> {type: 'fieldvalue', field: 'HasCompleteAppointment__c', operator: '!=', value: '0', encloseValueInQuotes: false},<br> {type: 'fieldvalue', field: 'First_Complete_Interaction_Date__c', operator: 'gte', name: 'Start', value: s, inactive: !s, encloseValueInQuotes: false},<br> {type: 'fieldvalue', field: 'First_Complete_Interaction_Date__c', operator: 'lte', name: 'End', value: e, inactive: !e, encloseValueInQuotes: false},<br> {<br> type: 'multiple', field: 'Center_Location__c', operator: 'in', values: location || t''], name: 'Location',<br> inactive: !(location && locationl0]), encloseValueInQuotes: true, encloseValueInParens: true<br> }<br> ];<br> return model.initialize();<br> }
What am I missing?