Activity Forums Salesforce® Discussions Formula Field in Aggregate Salesforce Query

  • Suyash

    Member
    March 30, 2016 at 11:55 am

    Hello Ajit,

    Formula fields are not "groupable" i.e they are not usable in the GROUP BY clause of a SOQL query.

  • Ravi

    Member
    March 30, 2016 at 1:47 pm

    Hi Ajit,
    Formula Fields cannot be used with the group by clause in SOQL query
    You can check whether a field is "groupable" or not using DescribeFieldResult.
    Example:
    Schema.DescribeFieldResult resultObject= Object__c.formula__c.getDescribe();
    if(resultObject.groupable == true){
    formula__c is groupable
    }else
    formula__c is not groupable

    • This reply was modified 8 years ago by  Ravi.
  • Parul

    Member
    September 7, 2018 at 12:19 pm

    Hi Ajit

    To Check whether any field is "groupable" or not,Please follow the below procedure

    Schema.DescribeFieldResult fieldDescribe = ObjectName.FieldName.getDescribe();

    if(fieldDescribe.groupable == true){

    Then Our Field is Groupable

    }

    Thanks

  • William

    Member
    November 12, 2018 at 4:33 am

    Formula fields are not "groupable" - that is, they are not usable in the GROUP BY clause of a SOQL query. There is limitation like Formula fields can't use in the group by Clause.

  • Divya

    Member
    November 19, 2018 at 5:19 am

    Hi

    Formula fields are not groupable  they are not usable in the GROUP BY clause of a SOQL query.

Log In to reply.

Popular Salesforce Blogs