I need my page to know whether X number of records in a certain status exist across a several different (generally related and/or child) objects. For instance, a user should not be able to click the submit button on an application (i.e., it should be disabled) unless there are zero related records in the wrong status, at least one related record in the right status, and at least two of the right kind of contacts. Standard rollup summary fields aren’t really a sustainable solution, and in some cases I won’t be able to use them anyway since the relationships aren’t always master/detail.
Seems like I can create a model for each criteria and use “has data rows” to control the rendering of the button. Would it be helpful to use aggregate models in this kind of situation? Is this a use case for the “rollup” grouping method (and how would that work)? Would doing so potentially reduce the number of separate queries/models the page would execute? The latter is my most significant concern, I suppose, since more queries means slower response time, and there could be a dozen or so. I’m just trying to find the most sustainable and efficient approach.
Question
efficient conditional rendering based on counting records in many models

This topic has been closed for comments
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.