How to clear options from a List field

Alon Grod
Tera Expert

Hi,

I have the field u_alon_test of type List with hard coded choices. Im trying to clear the choices using client script. I tried to use:

g_form.clearOptions('u_alon_test');

but its not working.

 

How can I clear the choices from a List field?


Screenshot 2024-03-18 at 18.22.21.png

Screenshot 2024-03-18 at 18.22.40.png

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Alon Grod 

 

https://www.servicenow.com/community/itsm-forum/how-to-clear-value-for-list-type-field/m-p/2649687

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

@Dr Atul G- LNG please stop comment on my posts this is not the way to get Likes

swathisarang98
Giga Sage
Giga Sage

Hi @Alon Grod ,

 

If you are trying to change Type of a field from Choice to List and if you want to remove those choices you will have to select all three and from Actions on selected row you have to delete it, through client script you can not remove this as these are not added through addOption but added through dictionary.

 

swathisarang98_0-1710781575799.png

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang