Create a Toggle Filter

Sometimes when in a workflow, the user just needs a filter that they can turn on and off again. Consider a sales rep who’s assigned accounts in many industries—but has a clear focus on one particular industry (Technology). The easiest way to let the user switch back and forth between Technology and the full list of industries is to with a Toggle filter.

Simple Toggle

Use the Toggle filter type to turn a model condition on and off.

Assumptions

Note

The example below assumes a Skuid page with:

  • a functioning model on an object that collects data about accounts (here, the Salesforce Account object)
  • a Table component on that model that lists account name, description, and other info, plus the account’s industry type

If using a different data source, the field names indicated may be different.

The goal? A toggle switch that turns the condition on and off. Slide in one direction to display account records for the selected industry (Technology); slide back to a display of all account records.

Note

One Toggle filter can affect multiple conditions on multiple fields. Just add a new condition for each field, and an effect for each condition.

Create the model condition [[]]

Create the model condition:

  • Field: Industry

  • Operator: =

  • Value:

    • Content: Single specified value
    • Value: Technology (or whatever industry you want to filter for).
  • State:

    • Condition state: Filterable default off (Skuid will automatically generate a name for the filter.)

Build the filter [[]]

On the Table component, click Add feature > Table filter, then configure the filter:

  • Filter type: Toggle
  • Filter method: Server
  • Pick options and condition: Manually
  • Filter label: Tech Accounts
  • Conditions to toggle: Leave blank.
  • Remember last-selected filter value: Checked

Add effects to the filter

To tell the filter which model condition to activate, click the Effects tab, then click add Add effect and configure effect:

  • Action: Activate. (Because the initial condition is inactive, the filter needs to be activated when users click on it).
  • Model condition: The industry condition created in the first step.

Toggle Filter with Subquery Condition

In the previous example, a Toggle filter was used to toggle a model condition. The condition filters for values on a specified field on the model’s object.

A subquery condition lets you filter for values on a field in an object that is related to the one used by the model. For example, an object that collects data about contacts often has the ability to access fields from an object holding account data. This makes sense because business contacts are generally associated with business accounts.

Now, imagine that sales rep who’s focused on one particular industry (but continues to have accounts in a few others). Their contact list, therefore, has records from multiple industries. But when the rep wants to display contacts in their primary area of focus, they need to easily filter out other industry contacts—and later, just as easily filter back to the list of all contacts, regardless of industry.

The goal? A button that turns the condition on and off. The first button click filters and displays contact records within the selected industry (Technology); the second click reverts the filter and displays all contact records.

Assumptions

Note

The example below assumes a Skuid page with:

  • a functioning model on an object that collects data about contacts (here, the Salesforce Contact object);

    • include the Account ID field—the field in the Contact object that connects the contacts to their respective business accounts in the Accounts object

      • Click fa-arrow-circle-o-right next to Account ID to open a list of the fields from the related object that can be added to the model and check the account name and industry
  • a table on that model that lists contact information, as well as the associated account name and the account’s industry type using the fields from the account model (see previous bullet)

If using a different data source, the field names indicated may be different.

Create the model condition [[]]

Click add to add a new condition on the contact model and configure:

  • Field: Use the field on the contact object that connects that contact to a business account. (In this case, the contact object’s AccountId field.)

  • Operator: in

  • Value:

    • Content: Result of a subquery
    • Join object: Account (the “other” object we want to include in this condition)
    • Join field: Id

Note

The AccountID field on the contact object will generally correspond to the ID field on the account object. This condition is telling Skuid to make that connection: “Use the contact object field that ‘bridges’ to the account object, and allows the data to make a connection between who the contact is, and what company they work for.”

  • State:

    • Condition state: Filterable default off.
    • Condition name: Give the condition a recognizable name, for example Account_Industry. This will be useful later when building the filter.

Create the model subcondition

On the condition itself, click add Add a subcondition and configure:

  • Field: Use a field that collects industry data.

  • Operator: =

  • Value:

    • Content: Single specified value
    • Value: Technology (or whatever industry you want to filter for).
  • State:

    • Condition state: Always on.

Build the filter [[]]

On the Table component, click Add feature > Table filter, then configure the filter:

  • Filter type: Toggle
  • Filter method: Server
  • Pick options and condition: Manually
  • Filter label: Tech Accounts
  • Conditions to toggle: The condition created in the first step.

Add effects to the filter

To tell the filter which model condition to activate, click add Add effect and configure effect:

  • Action: Activate
  • Model condition: The condition created in the first step.