Use Select option with Multiple Conditions and Fields

Imagine a Table component that displays data on sales opportunities. The sales reps using the page want to filter for three different things—represented by three different fields:

  • Their assigned leads—the ones they “own” (an OwnerID field)
  • The records they have updated (a LastModifiedById field)
  • All records updated within a certain period, for example, “this month” (a LastModifiedDate field)

Here’s how to use multiple conditions to give users all these options on a single filter dropdown.

The goal? A filter that allows the user to select from a dropdown of pre-selected options to filter leads to display either:

  • Those the user owns
  • Those modified by the user
  • Those modified within a specified time frame

image1

Assumptions

Note

  • a functioning model on an object that collects data on opportunities or leads. (In this example, we use Salesforce’s Opportunity object).

  • a Table component that model with fields for:

    • Name
    • Amount
    • Close Date and Last Modified Data
    • Last Modified by ID and Owner ID

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

Create model conditions [[]]

Create three separate conditions, one for each option.

The record owner condition [[]]

  • Field: The field that records the record’s owner: OwnerId

  • Operator: =

  • Value:

    • Content: The Skuid/Salesforce/Data source user attribute. (The correct option depends on the data source used.) This identifies the user accessing the data.
    • User Attribute: User ID
  • State:

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

The modification condition [[]]

Duplicate the steps taken for the last condition, but use a field that records who modified the records (for example, the object’s LastModifiedById field.)

All other properties are the same.

The modification date condition [[]]

This filter is a little different, since it uses a datetime value.

  • Field: The field that records who modified the records: LastModifiedDate

  • Operator: =

  • Value:

    • Content: Single specified value
    • Value: Select the desired value from the picklist, for example, This Month, or This Week.
  • 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: Select option
  • Filter method: Server
  • Pick options and condition: Manually
  • Filter label: Sort my leads
  • Model condition to affect: None
  • Create “None Selected” option: Checked.
  • “None Selected” option text: Sort by …
  • Display as: Dropdown.

Add filter sources [[]]

Now, identify the sources for the filter’s dropdown menu options. On the Choose amount filter, click add Add option source, then configure:

  • Source type: Manual

The filter needs three filter options (one representing each condition created in the first step).

First filter option (“Records I own”) [[]]

On the Source: Manual option source, click add Add option, to create an option for the first item in the filter. Then configure:

  • Which conditions will this source’s option affect?: Affect other conditions. You don’t want to activate any default conditions, but instead activate one of those that you created specifically for this filter.
  • Label: Owned by Me
Add effects to the option

Click add Add effect and configure:

  • Action: Activate

    Note

    Do not use Activate and Set.

  • Model condition: The condition created earlier for the record owner.

Second and third filter options [[]]

Repeat the steps above to add two additional filter options and their effects:

  • One with an option label of Modified by Me with an effect that activates the model condition about who modified the record.
  • Another with an option label of Last Modified with an effect that activates the model condition about when the record was modified.