function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
HartleyHartley 

Error trying to get data from Custom Object

Hello,

Thanks for taking the time to help me or look into my issue.

I seem to be getting an error when attempting a simple SELECT query in my lightning App. I know the issue is with the Custom Object as if I change the table and List to a different object I can get the data.

The following is the code:

public class StudentRosterListController {
    @AuraEnabled
    public static List<custom_object__c> getStudents(){
        return [SELECT Id, Name FROM custom_object__c];
    }
}


And here is the error message:

"message": "An internal server error has occurred\nError ID: 1148389056-13703 (408822391)"

Again if I replace the custom_object__c with different objects it works for somes and doesn't for others. Any help is greatly appreciated, thank you.

 
Best Answer chosen by Hartley
HartleyHartley
Hey,

I actually just figured it out by ensuring Debug mode was set and viewiing the log file in the Dev Console when loading the page. My issue was due to a Limit size that I was unaware of when attempting to do Aggregation on the DB. I was way over the 50k limit, and so will need to look into implementing pagination using LIMIT and OFFSET. When I set the LIMIT in the query using the Custom Object then the data is displayed. Thank you very much for attempting to assist me. 

All Answers

sfdcMonkey.comsfdcMonkey.com
hello ,Hartley Jean-Aimee 4
your apex method and SOQL query both are correct, can you share your lightning component with controller OR helper where you call that apex method so i review your problem.
thanks 
HartleyHartley
Hey,

I actually just figured it out by ensuring Debug mode was set and viewiing the log file in the Dev Console when loading the page. My issue was due to a Limit size that I was unaware of when attempting to do Aggregation on the DB. I was way over the 50k limit, and so will need to look into implementing pagination using LIMIT and OFFSET. When I set the LIMIT in the query using the Custom Object then the data is displayed. Thank you very much for attempting to assist me. 
This was selected as the best answer
sfdcMonkey.comsfdcMonkey.com
cheers mate ;-)