I'm trying to write a query that gives me the name of users and the total number of ids assigned to them.
Here I've Daily_Task__c
a custom object with a lot of fields, here I'm trying to get the total number of cases assigned to a user and I'm trying the below query
SELECT count(id), User_Name__c FROM Daily_Task__c group by User_Name__c
when I'm running this query I get the error as below.
[object Object]: User_Name__c FROM Daily_Task__c group by User_Name__c ^ ERROR at Row:1:Column:58 field 'User_Name__c' can not be grouped in a query call
but when I do the below query it is working fine
SELECT id, User_Name__c FROM Daily_Task__c order by User_Name__c
it is showing the list of all the ids and users(sorted).
please let me know on where am I going wrong with the group by
case and how can I fix it.
Here is what I see when I run System.debug(Daily_Task__c.User_Name__c.getDescribe());
in my developer console.
00:32:47:018 USER_DEBUG [1]|DEBUG|Schema.DescribeFieldResult[getByteLength=3900;getCalculatedFormula=Daily_Update__r.Ass_Usr___r.First_Name__c;getCompoundFieldName=null;getController=null;getDefaultValue=null;getDefaultValueFormula=null;getDigits=0;getFilteredLookupInfo=null;getInlineHelpText=null;getLabel=DE Name;getLength=1300;getLocalName=User_Name__c;getMask=null;getMaskType=null;getName=User_Name__c;getPrecision=0;getReferenceTargetField=null;getRelationshipName=null;getRelationshipOrder=null;getScale=0;getSoapType=STRING;getSobjectField=User_Name__c;getType=STRING;isAccessible=true;isAggregatable=true;isAiPredictionField=false;isAutoNumber=false;isCalculated=true;isCascadeDelete=false;isCaseSensitive=false;isCreateable=false;isCustom=true;isDefaultedOnCreate=false;isDependentPicklist=false;isDeprecatedAndHidden=false;isDisplayLocationInDecimal=false;isEncrypted=false;isExternalId=false;isFilterable=true;isFormulaTreatNullNumberAsZero=true;isGroupable=false;isHighScaleNumber=false;isHtmlFormatted=false;isIdLookup=false;isNameField=false;isNamePointing=false;isNillable=true;isPermissionable=true;isQueryByDistance=false;isRestrictedDelete=false;isSearchPrefilterable=false;isSortable=true;isUnique=false;isUpdateable=false;isWriteRequiresMasterRead=false;]
Thanks