Limit Records with a Subquery Condition

The Result of Subquery condition creates a condition that simulates subqueries in SQL or SOQL.

For example, users may need to see all contacts from client accounts in healthcare industries. This would require a SQL/SOQL statement similar to the following:
FROM Contact
WHERE AccountId IN ( SELECT ID FROM Account WHERE Industry = 'Education' )

Here’s how to do this declaratively.

Using a Subquery Condition



This tutorial assumes you have a Skuid page with a functioning model on an object that keeps track of contacts. The page includes a Table component attached to that model.

Create the condition [[]]

  1. In the Elements pane, click the Models tab.
  2. Click the model name.
  3. Below the model name, click Conditions:
  4. Click add Add to create a new model condition.
  5. Click Save.

Configure the condition [[]]

Click the newly created condition, then edit:

  1. Field: AccountId
  2. Operator: =
  3. Value:
    • Content: Result of a subquery
    • Join object: Account
    • Join field: AccountId
  4. State: Filterable default off.

Add a sub-condition [[]]

  1. Click the model condition created in the previous section.

  2. Click add Add a Sub-Condition to create a new sub-condition to the parent condition and edit the sub-condition:

    • Field: Industry
    • Operator: =
    • Value:
      • Content: Single specified value
      • Value: Healthcare
    1. Click Save then Preview.

The end user’s experience

When the page is loaded, only contacts from accounts in the healthcare industry are displayed.

Want to take it to the next level? Make the subquery condition a toggle filter on the page, so end users can turn the condition on and off.