You need to sign in to do that
Don't have an account?
Akhil Katkam 5
getting error as formula field cannot be grouped in a query cell
Hi Developer Community ,
i have an apex class where i am querying fields based on the stage name and formula field (month__c)
here is the code:
i am getting an error as :
[object Object]: ('Closed Won') GROUP BY StageName, Month__c ^ ERROR at Row:1:Column:135 field 'Month__c' can not be grouped in a query call
month__c is a formula field based on close date ,
can anyone please help me with the solution
Thanks in Advance
i have an apex class where i am querying fields based on the stage name and formula field (month__c)
here is the code:
[SELECT SUM(Amount) amount, StageName stage ,Month__c month FROM Opportunity WHERE StageName NOT IN ('Closed Won') GROUP BY StageName,Month__c];
i am getting an error as :
[object Object]: ('Closed Won') GROUP BY StageName, Month__c ^ ERROR at Row:1:Column:135 field 'Month__c' can not be grouped in a query call
month__c is a formula field based on close date ,
can anyone please help me with the solution
Thanks in Advance
You are getting this because Formula field doesn't support Group By.
-https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_group_by_considerations.htm
-https://trailblazer.salesforce.com/ideaView?id=08730000000HlNtAAK#:~:text=Give%20it%20an%20upvote%20or%20downvote.,-Matthew%20Scholtz&text=Currently%20it%20seems%20that%20formula,clause%20of%20a%20SOQL%20query.
Please mark it as Best Answer if it helps you.
Thanks & Regards
Suraj Tripathi