Problem: Certain profiles are seeing a heap size error from Salesforce when loading a Skuid page.
Resolution: Set up any model conditions that use data from another model to abort model query if there are no rows in the other model, and limit how many rows and fields your models are loading to avoid Salesforce’s heap size error.
Affects: Skuid on SFDC, Skuid Platform
A client’s page has two models - Accounts and Contacts, for example. The secondary model (Contacts) has a model condition set up, which should only allow records that have a field value that matches a field in the primary model (Accounts). In other words, it should only load contacts whose AccountId value is an Id of one of the rows in the Account model.
Also, the primary model (Accounts) has its own condition on the OwnerId field, which should mean that only Accounts that are owned by the user are loaded.
Some profiles in the client’s org were seeing a heap size error, while other users were able to use the page without any trouble.
There are a few important questions to consider in this scenario.
First, what is a heap size error? A heap size error is something Salesforce will send if a page has requested too much data in one query. This limit is set by Salesforce
- . So, to work around it, Skuid recommends always setting reasonable limits on how much data a model will load (in short, be sure to set a max # of records to load, and only load necessary fields.
Second, what should the secondary Contacts model do if the primary Accounts model has no rows?
- Should the model's condition be deactivated, allowing it to load unfiltered records? Or, should the model's query be aborted? In this case, if there is no Account record for the Contacts model to use as context, we probably do not want the Contacts model to load unfiltered contact records. Instead, let's set the Contact model's AccountId condition so it will abort the Contacts query if there's no Account record available for filtering.
Finally, why are some users seeing the heap size error, and not others? If the user owns no accounts, then in our example setup, the Accounts model will not load any records. This means the Contacts model will, by default, try to load all
- Contact records in the org, if no max # of records is set. If this model tries to load too many records, the user will see Salesforce's heap size error. If the user does own accounts,
Set up the Contacts model’s condition to abort model query if there are no rows in the parent model. And as a best practice, limit how many rows and fields your models are loading to avoid a heap size error.
- If some users see an issue like a heap size error while others don't, think first about what differences might be present between affected/unaffected users: profile, role, or access to data.
- Some users may see many more records than others, and if the model doesn't have reasonable limits set, those users will see a heap size error in scenarios like this, because they can access lots more data.
- Some users may not have access to a field that's used in a model condition. If that's the case, such a model would not be able to filter records by the field, and again could load too many records and trigger a heap size error.
- Make sure there are data limits on models so heap size errors don't show up, because they are not easy for a user to understand.
- Make sure that important model conditions have the correct behavior defined, and will handle scenarios the right way for all users. By default, model conditions will deactivate if their source value isn't available, but this can lead to heap size errors, as discussed above.
Get help with an issue
Ask in the Skuid user community in the
If you have paid support, ask your question on our support portal
- If you’re interested in support, contact your Account Executive.