How to show more than 200 options in Picklists for Reference fields?

  • 2
  • Question
  • Updated 4 years ago
  • Answered
Skuid lets you display Reference fields (in edit mode) either as Autocompletes or Picklists. In Autocomplete mode, all records of the related object are searched, but in Picklist mode, a max of 200 options are available to select from. Is there a way to raise the limit on the number of options that are available, or to show all options?



Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb

Posted 6 years ago

  • 2
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Official Response
This can be solved by using the rows in a Model as the source of your Picklist options, instead of the options being automatically provided by Skuid - in which case Skuid just chooses the first 200 records.

For instance, say that you have a field called "Birth_Country__c", which is a Lookup field to a custom "Country__c" object, and you have created a record for all 268 ISO countries. You've added this field to your Skuid page, and you want users to be able to pick a Country from a list, rather than having them have to enter the country name. Here's the best way to do this:

1. Create a "Countries" Model in your Skuid page

For Basic properties:

-Model Id: Countries
-SObject Type: Country__c

Your Advanced Properties should look something like this:



Notice two things here:

(1) The "Max # of Records" has been left blank. This makes it so that all 268 Country records will be retrieved into the Model.

(2) You can order these records however you'd like! For instance, if you always want "United States" to show up first in your Countries list, you could add an additional "Order__c" Number field on your Country object, and then order by that field first, and THEN by Name, by using "Order__c NULLS LAST, Name" as your "Fields to Order Records By".

Make sure to add the "Name" field, or whatever field on the Country object you'd like to display to your users (e.g. Country_Long_Name__c), into your Countries Model's Fields.

2. Edit the Advanced Properties of the Reference field in your Field Editor or Table component

If you go in to your Field Editor or Table component which contains the "Birth_Country__c" field, and click on the field's "Advanced" properties, by default what you will see is that "Option Source" is set to "Automatic". Here's what to change:

a. Set "Option Source" to "Model"
b. Set "Option Model" to "Countries"
c. Set "Display Template" to "{{Name}}", or whatever field on the Country__c object you'd like to display to users, e.g. "{{Country_Long_Name__c}}".



3. Click Save, then Preview!

You should now see all Countries in your Birth Country Picklist!



**NOTE**: When you use a Model as the Option Source, but have "Display As" set to "Autocomplete", only the rows in this Model will be used in the Autocomplete search. For example, if you are doing this, and you add a Condition to your Countries Model such that only North American countries are retrieved, then when you search for "Algeria" in the autocomplete box, nothing will be returned, even though there is a Country__c record whose Name is "Algeria" in your database --- because you have instructed Skuid to only search on records in your Countries Model.