Auto-complete for reference fields
By default, a reference field auto-completes as the user types in the field.
Dictionary attributes for auto-completion of reference fields
There are dictionary attributes that are specific to reference fields and that determine auto-complete behavior.
| Attribute | Description |
|---|---|
| ref_auto_completer | Specifies the name of the client-side JavaScript class that creates the
drop-down auto completion choices. Valid class values include:
|
| ref_ac_columns | Specifies the list of reference table columns to display. Separate column names with a semi-colon. For example, ref_ac_columns=user_name;email;sys_created_on allows auto-complete to match text from the user_name, email, and sys_created_on columns. |
| ref_ac_order_by | Specifies the reference table column that sorts the auto-completion choices. For example, ref_ac_order_by=name sorts the auto-completion choices alphabetically by name. |
Auto-complete UI features
The AJAX table completer class has a number of UI improvements.
- The table completer always displays the number of records the auto-complete query finds.
- The table completer highlights the entire selected row by changing the color of the background and text.
- The table completer lists a value for every column.
- The first time a value appears in a column, the table completer displays it in black text.
- The table completer displays subsequent duplicate values in grey text. Previously, the table completer displayed an empty cell in a column containing a duplicate value.
Set the ref_auto_completer=AJAXTableCompleter dictionary attribute to use these improvements.
Define auto-complete attributes for all references to a table
A field inherits and uses the reference table's auto-complete attributes unless the field has its own value for the same attributes. You can define the attributes for references to a table, and it affects every form that references that table.
Antes de Iniciar
Por Que e Quando Desempenhar Esta Tarefa
A field-level attribute overrides a table-level attribute of the same name. If a field uses different reference attributes from those that are defined for the reference table, then the field uses both sets of attributes.
Procedimento
O que Fazer Depois
Remove the display value column
You can remove the display value column from a reference field by setting the ref_ac_display_value attribute to false.
Antes de Iniciar
Por Que e Quando Desempenhar Esta Tarefa
This example describes how to remove the display value column from references to the User [sys_user] table and replace it with references to the first_name and last_name columns.
Procedimento
O que Fazer Depois
Improve auto-complete queries
By default, all reference fields use a starts with query to search for matching text in the reference table. This prevents auto-complete from executing inefficient contains queries every time a user searches a reference field. You can require all reference fields to use a starts with query.
Antes de Iniciar
Por Que e Quando Desempenhar Esta Tarefa
This procedure describes how to change the glide.ui.ref_ac.startswith system property to always use a starts with query.
Procedimento
Configure auto-complete to match text from any reference field
By default, auto-complete only matches text in the display value column. You can configure a reference field to match text from any additional column the reference field displays.
Antes de Iniciar
Por Que e Quando Desempenhar Esta Tarefa
You can add the ref_ac_columns_search attribute to enable auto-complete to match text in any column listed in the ref_ac_columns attribute. Set the ref_ac_columns_search attribute to true to match text from all reference field columns. By default (or when this attribute is false) auto-complete only matches text in the display value column.
Procedimento
Exemplo
ref_auto_completer=AJAXTableCompleter ,ref_ac_columns =sys_class_name ,ref_ac_order_by =sys_class_name ,ref_contributions =task_show_ci_map ;ci_show_incidents
Enable contains auto-complete searches
By default, the reference auto-complete uses a starts with search. A user preference can be created to implement a contains search.
Antes de Iniciar
Procedimento
O que Fazer Depois
Wildcards in reference auto-completes
Wildcard searches use the auto-complete functionality.
Use an asterisk in the reference field for wildcard searches.
If two asterisks are entered, a list of available records display in the auto-complete suggestions.