remove option from a list collector on a record producer

MWALR
Kilo Contributor

Hi,

I have a requirement on a record producer to remove certain options when another variable choice is selected above. e.g. if subcategory is "lease", then remove option "other" in the list collector.

I have tried a catalog client script but i can't get it to work. This is onChange of the subcategory variable:

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}

if (newValue== 'Lease') {

g_form.removeOption('u_type', 'Other');

}

Can anyone help?

Many thanks

M

5 REPLIES 5

Harshad Wagh
Tera Guru

Hi,

 

maybe remove Item will help here.

 

Please have a look at below threads.

 

https://community.servicenow.com/community?id=community_question&sys_id=75c89545db5b9f400be6a345ca961988

 

Thanks

Harshad

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

If i understood you properly, then you have to filter list collector depending upon certain variables.

If yes then you need OnChange client script on RP.

 

See below links for scripts:(If Service Portal then we have to twick the script little bit)

https://www.servicenowguru.com/scripting/client-scripts-scripting/changing-filter-list-collector-variable-client-script/

https://community.servicenow.com/community?id=community_question&sys_id=6d910769db98dbc01dcaf3231f96193f

 

Thanks,
Ashutosh
ServiceNow MVP 2019

 

Please Mark Answer as Helpful or Correct Based on it's impact.

yes that's right. My coding is not the best; how would i apply this in my setting? It seems to be removing the filter entirely, wheras i want to remove 1 option from the list collector. Many thanks

HI,

Is this on service portal or normal view.


Thanks,
Ashutosh