Create a Reference Select2 field
ServiceNow uses a select field for reports that looks really cool:
A question came up on the community about how, exactly, you could create one. Digging into the elements of the field, we can find that it is a select2 field:
Select2 offers their code publicly: Select2 - The jQuery replacement for select boxes
So, this should not be too difficult a task to do. There are two paths you could take, downloading the scripts from select2 and adding them as global UI Scripts in your instance:
and calling them in UI stuff like:
or just calling them directly from the source:
Finally, your code would look something like:
<?xml version="1.0" encoding="utf-8" ?>
</p> <p> $j(document).ready(function() {$j(".js-example-basic-single").select2();}); </p> <p>
var table = new GlideRecord('sys_db_object');
table.orderBy('label');
table.query();
${table.label} /j:while
This just queries the tables of the system, like the report example, and adds all the results into options. The end result looks like this:
https://www.servicenow.com/community/in-other-news/create-a-reference-select2-field/ba-p/2280613