How to have no radio button selected on catalog item variable on form load?

chooi
Tera Expert

I have a mandatory variable of type Lookup Multiple Choice (ie create radio buttons using data from a table) on a record producer. 

By default, the first radio button is selected on form load.

Is it possible to have no radio button selected on form load?  

I have tried setting ‘Do not select the first choice’ option to true but this does not appear to work and I want to avoid adding a —None— radio button using ‘Include none’ in Type Specifications. 

5 REPLIES 5

Martin Ivanov
Giga Sage
Giga Sage

try with onload catalog client script

g_form.clearValue('your variable')

Please Mark Correct And Helpful. Thanks!


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

Musab Rasheed
Tera Sage
Tera Sage

Hi,

Try something like this.?

var var_ctrl = g_form.getControl('variable_name');
var_ctrl.value = '';
Please hit like and mark my response as correct if that helps
Regards,
Musab

thanks Musab. Forgot to mention this is required on Service Portal and ServiceNow documentation indicate getControl() is not available in mobile scripts or Service Portal scripts.

 

thanks Martin. I tried that however that appear to clear the sort order of the radio buttons. And if I click on the first radio button it sorts the radio button by name. For example, if the items in table are Yes (10), No (20) and Maybe (30), the radio button will appear as Yes, No and Maybe on load. After the clearValue, if I select Yes, the radio buttons will re-sort and appear as Maybe, No and Yes, so not ideal.