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 'refresh' choice field via catalog client script in serviceportal?

Zod
Giga Guru

Hi,

I have a choice field in a cat alog item in the service portal. Via changes of other fields, the choices might get extended via ajax call with alternative options .... . No I need to be able to clear those choices (that are not physically in the choice list table) after a change of other fields. This need to happen via a catalog client script ... something like g_form.refreshOptions('field'); would be what I'm looking for ... 

Variable Attributes (ref_qual_elements) are no option, as the added Otpions still remain in the available choices. Also removing the options will not work, as I do not know what the options might be ... So just the "original" options should be reloaded .. 

Thanks!!

5 REPLIES 5

Stewe Lundin
Mega Guru

Have you tried to set the Value to nothing

g_form.setValue('my_cList','')



Thnx. But not working.

The old option is still part of the choice list ;-/

Omkar Mone
Mega Sage

Hi

For this maybe you need to reload the page to acheive something like this .

Reloading the page can't happen, as there are many variables filled within the process. So on change of some of them, the choice list need to get 'refreshed' ... . 

The only option is nearly see is to remove all options and just manually add the valid once ... but this seems to be not realy a good practise ...