Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to add search option on HTML select tag in servicenow widget

Rajesh B V
Kilo Contributor

Hi All,

Kindly suggest to add search option within dropdown on HTML select tag in servicenow SP widget.

Suppose if we have a long dropdown list to select it, we need to scroll it until you did not find the item you are looking for. Find below sample screenshot

 

find_real_file.png

2 REPLIES 2

Shubham Tipnis
Kilo Sage

Hi Rajesh,

 

If you are fetching the dropdown options as records in a table, then it is better to use sn-record-picker.

E.g. If you want to use this for the user table, then you need to update the parameters in the HTML Directive, here we changed table to be "'sys_user'".

<sn-record-picker field="location" table="'sys_user'" display-field="'name'" value-field="'sys_id'" search-fields="'name'" page-size="100" ></sn-record-picker>

I've added some more context to the properties found on documentation page.

Check this blog for more info: https://community.servicenow.com/community?id=community_blog&sys_id=54bde6a9dbd0dbc01dcaf3231f96193f

 

Property Description  
field a JavaScript object consisting of “displayValue”, “value” and “name”  

table

the table to pull records from -
default-query the query to apply to the table  
display-field (or display-fields) the display field  
value-field the value field (usually sys_id)  
search-fields the fields to search   Use this option to apply a search in the dropdown
page-size  number of records to display in the dropdown  

 

Else if you want it purely html based then check this link.

 

Please mark correct/helpful if applicable.

 

Regards,

Shubham

Regards,
Shubham Tipnis
 ServiceNow Enthusiast
️ 3x Rising Star (2022–2024) – ServiceNow Community
 Sharing insights, use cases & real-world learnings from the Now Platform
 Always learning. Always building.

Hi Shubam,

Thanks for your reply.

The dropdown options are from the Third party tool response.