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
Andrew ChabotAndrew Chabot 

Apex Controller Limit?

I am on the Trailhead = UX Prototyping Basics: Iterate on Your Prototype and I cannot get the Apex Controller, limit the account, contact and lead SOQL to return 5 records.  Can someone help me with what the code should be for this?
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Andrew,
  • Thanks for reaching us. May I know the exact issue you are encountering? So that I can understand the issue better and can assist you accordingly!
  • Please share the screenshot of the error.
Apex controller Limt
  • while writing extension controller in VF page you can use more than one extensions in your visual force page. separated by commas, There are no limitations for using the extension.
Please refer the below link for reference I hope it will be helpful.

Best Regards
Rahul Kumar
Andrew ChabotAndrew Chabot
Error MessageCode for the Apex Controller

Can you please help me with what the correct code is to set the limiting query results to 5?
Andrew ChabotAndrew Chabot
@rahul kumar does that help?
 
Velma McConnellVelma McConnell
I could use help with this as well
 
Velma McConnellVelma McConnell
I've got your answer.  In the SearchResultsController, your SOQL has a limit.  You can see  that on the righthand side of the picture below.  Yours should say LIMIT 4 for Account, 3 for Contact and 2 for Lead (I think that wa the original values.  Change that to 5 and you've got your challenge completed!

User-added image
Andrew ChabotAndrew Chabot
Velma,  Can you screen shot what you have for the ResultsSectionsController.js please?

 
Velma McConnellVelma McConnell
Hi Andrew, 

Here is the screenshot.  I originally put the LIMIT 5 in this controller but it was the wrong controller.  So I removed it and added to the SearchResultsController.apxc


User-added image
Tuscan BasierTuscan Basier
Hi There, 

I had the same issue. 

All you need to do is click File>Open>Classes  you will see that there is a SearchResultsController field, click on that to open. The editor will open, and all you need to do is Change the Limit to 5. Let me know if this helps.

 
Rebecca MonroyRebecca Monroy
Yes, it works
Thanks!!
Shannon Carey 3Shannon Carey 3
@Tuscan Basier, Thanks so much! I have been fighting this one forever! This really helped out.