Generate a Picklist filter using Aggregate model - heap error

I am building a community feature for users to come and look up product pricing.  I need a way for a community user to pick a Product (native SF products table) from a picklist, and then it calculates a price. I’ve got a couple problems:

1) I’m using a Table Filter (table is hidden with CSS) to drive the products model.  The picklist values for the Table filter is created using an Aggregate model off “All Products”.  It looks a little weird but I couldn’t think of another way to generate a picklist for our product entries.

2) I get a heap error ONLY when logged in as a community user (not sys admin or internal user) that is because of this Products aggregate model.  My model has no aggregations because I am only trying to generate filter picklist options off the Name field.  Do I need one?  Limiting the model to 50 records works fine, no limit throws the heap error.  I want my users to see all the products in the picklist.

So, is there a better way to dynamically create a picklist for my users to pick a product from?
And are there any ways to get around the heap error by tweaking my aggregate ‘AllProducts’ model?


I really don’t think you need an aggregate model to get your “all products” list.  A normal model on the product sObject should provide the same effect. 

How many products do you have?   It may be that you simply have too many - but this would occur if you had say 10,000…  Probably not likely in your case. 

If the community user has some record level security limitiations on the product model - you might see these sorts of errors.  If salesforce has to evaluate sharing rules for each record,  they want that query limited more.  Your admin account doesn’t evaluate sharing rules and I’m guessing your internal user profile does not either.   See this forum post.  https://community.skuid.com/t/error-implementation-restriction  and look for Zach’s excellent analysis. 

10,000 is completely reasonable for us.  :)  Right now, the conditions I have are returning ~ 4000 products, but one of our business units is working on their pricing and that will ADD 10,000+ more records.  So… yeah… lots.  It doesn’t appear to be security.  Products is Public, and when I limit the model to 50 records, the page loads no problem and the customer user can see the results.

So, I really want a look up to the Products Object so they can pick a product that they want priced.  Can I do a custom component/field to do that and then pass that value into my snippet that is doing the price calculation?  I hunted around the docs on custom components and it seems like it might be, but I wasn’t able to connect all the dots.