Topic
I added a filter or a model condition to my existing page, but it’s being ignored.
Resolution
Make sure all model conditions are represented in the model’s grouping logic.
Problem Details
- A new automatic filter has been added to the page.
- Users can choose options in the filter, but it has no impact on which records are shown on the page.
- The page in question was built a while ago by someone else.
- This applies to both v1 and v2 pages.
Resolution Process
- Confirm model conditions and automatic filters are set up correctly according to Skuid documentation and the needs of your use case.
- Confirm users have permission to access all the necessary fields and that the environment has all the necessary test data.
- If your model condition depends on a field from another model or URL parameter, make sure the field’s value or the URL parameter is populated whenever the model is being queried.
- For pages that are complex or unfamiliar to you, try creating a simple page from scratch and adding the new filter or model condition to that page’s model. This allows you to remove other variables and confirm that the problem is occuring with the new filter or model condition.
- If the test page is working as expected, compare the two pages to look for key differences in their models. Perhaps the real page has some actions or JavaScript snippets that are affecting the model. If so, try removing those to see if the behavior changes.
- If the test page isn’t working as expected, try simplifying it even further. Perhaps try using a different object for your model or a different filter type.
- Try removing or deactivating other model conditions so only the ignored model condition and filter are applied.
- Open your browser’s Javascript console (info for Chrome or Firefox) and run skuid.debug.modelMap() for v2 pages or skuid.model.map() for v1 pages; these allow you to see raw model data.Review the status of each of your model conditions and the grouping logic that’s being applied to the conditions.
In this example, the condition logic is 1 OR 2 OR 3, but we know the model has 5 conditions, so perhaps those last two conditions are being ignored.
For Salesforce objects, open up each model listed by the above commands and scroll down to see the Salesforce SOQL query string used to retrieve the model’s records. Check for any extra or missing WHERE statements. You can also copy and paste the query string into Salesforce’s developer console to see how it behaves outside of Skuid pages.
In this example, looking at the query string, we can see that the WHERE clause doesn’t make any references to the fields in our two new conditions, which confirms the theory mentioned above.
By default, the grouping logic should have all active conditions applied. The WHERE clause should contain all five conditions and use AND, not OR.
Outcome
- We found that the grouping logic for this model had been customized in the past to read 1 OR 2 OR 3. This needs to be adjusted to accommodate any new model conditions we add.
- In this example, if you add a fourth model condition to this model, the new condition will be ignored until you update the custom logic to account for condition 4, like 1 OR 2 OR 3 OR 4 OR 5, or (1 OR 2 OR 3) AND 4 AND 5, etc., depending on your desired logic.
- This is also true if you add an automatic filter to the model. When you add an automatic filter, the page Composer will add a grayed-out autofilter condition to the model which needs to be represented in the model’s custom logic.
Additional Information
- By default, model conditions use simple AND operators for their logic, which means all active model conditions must be true for a record to be returned.
- More complex grouping logic is possible using parentheses for grouping conditions together, and OR operators in addition to AND operators.
- Custom grouping logic is a useful model feature, but it’s also easy to overlook.
Get help with an issue
- Ask in the Skuid question forum.
- If you have a support entitlement, ask your question in Nintex Customer Central.