Tips & Tricks: Lookup Filters

What are lookup filters?

Lookup filters let you control which results are shown in a reference field.

You can add lookup filters in Skuid from Field Properties > Filters.

Why use lookup filters?

Lookup filters help you improve the end user experience. Instead of being inundated with options, some of which may not be valid, the user will see only the options that make sense.

For example, if you have 3 different product lines you can limit the lookup field to the particular product line you want users to be able to choose from on that specific page.

App Composer

Runtime

Pro Tip: As you can see from the screenshot above, Skuid also allows you to customize the way lookup options are displayed in the search results and even which fields are searched. See Using Fields > Search Properties for more information on how you can customize the lookup field search.

Create complex filter logic

Lookup field filters by themselves do not accept complex logic. When you add multiple conditions, they will all be applied together. For example, the conditions shown below Family = ‘Accounting’ and Product Type = ‘Subscription’ will return a list of products where Family is Account and where Product Type is Subscription.

Screenshot: 2 lookup filters that will be applied together

For more granular control over condition logic, it’s best practice to create a model to source your lookup options. For more details, see #2 under Best Practices.

Best Practices for Lookup Filters

For reusability, use Salesforce Lookup Filters.

For lookup filters you want to always apply to a Salesforce reference field, we recommend setting up the filter on the Salesforce side rather than configuring it on each Skuid page. See the Salesforce documentation on lookup filters.

Use models to source lookup filter options.

For scenarios where you have more specific business requirements, you can create a model to source the options for your picklist and take advantage of model condition grouping logic. See Model Conditions > Properties > Grouping Logic.

Screenshot: This model uses complex condition logic to draw in products from certain families and types that are active and using standard prices

Once your model is set up, you can create just one filter on the lookup field where the record Id is in Field From Another Model. Select your model and the appropriate source field.

Note: Keep in mind that the lookup will only display records that have been loaded in your model. For objects where there’s a smaller number of records you can clear the Max # of records (limit) property in the model. However, for objects with thousands of records, we recommend honing your conditions as much as possible to keep from querying too much data. Then you can use an action sequence that runs on page load to load the records in batches in the background. For Salesforce data sources, there’s a handy Load All Remaining Records action you can use. See Salesforce > Data Source Actions > Load All Remaining Records.

Pro Tip: You can also use models to source custom Filter options.

Dive Deeper

  • Use customized options based on the user running the page. See Model Conditions > Properties > Skuid user attribute / Data source user attribute for more details about the type of values that are available in conditions out of the box. You can also create a model to bring in additional data from the running user.
  • Create a custom search flow: use “when field is updated” model actions to run custom actions when a user selects an option from your customized lookup.

Resources

Get help with an issue

  • Ask in the Skuid user community in the questions category
  • If you have paid support ask your question on our support portal skuid.freshdesk.com
  • If you’re interested in support, contact your Account Executive.