clearoptions() and removeoptions() not working

amaradiswamy
Mega Sage

Hi All,

Based on the conditions, i need to add/remove options from the choice data type fields. I have written 2 scripts. one script is working as expected but in second script it is not clearing the options eventhough it is going into the loop( i have checked by using alert). And i have checked all the field names and choice values.

What could be the possible reason for this behaviour and how to fix this issue?

Thanks and regards,

Swamy

9 REPLIES 9

Hi Swamy,



I just wanted to confirm oen thing that the field u_xyz is drop down value as clearoptions work for drop down values.


I am assuming that it is drop down only.



Please suggest.



Regards,


Shamma


Hi Swamy,



Please find the details below:


clearOptions(fieldName)


Removes all options from a choice list.



clearValue(fieldName)


Removes any value(s) from the specified field.



Please make sure that you are uisng clearoption for option field and clear value for others.



GlideForm (g form) - ServiceNow Wiki


Hope that helps you!



Regards,


Shamma


Hi Shamma Salhotra, Rohit Sarkar,Manoj Kumar ,



Thanks to you for your time.



Actually, the fields are adde twice on the form ( in 2 sections) and i have noticed it, after removing the fields from 1 section then everything looks fine.



Regards,


Swamy


clearOptions() wont work if it is not a choice field. And "else" part is working ?


Manoj Kumar16
Giga Guru

Yes I noticed that but i thought thats your requirement.