Can the "clear" button on a record picker input be removed?

CodingSN247
Kilo Contributor

I'm using a sn-record-picker on a service portal widget. When an option is selected and the box is filled an 'x' is added to the input that allows a user to clear it. Can this 'x' be removed or prevented from showing up? 

find_real_file.png

2 REPLIES 2

Chris Stoll-SN
ServiceNow Employee
ServiceNow Employee

Not sure of the reason for needing to remove the quick ability to clear the input, but add this to your widget's CSS -

.select2-container.select2-allowclear .select2-choice abbr{
  display: none !important;
}

 

justinruddell
Giga Contributor

Probably a bit late but if you add the following to your "settings" in the record-picker setup it will remove the ability to clear.

options="{allowClear: false}"