- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2020 06:20 AM
How do I clear the values of a list collector when the selection from lookup select box is changed?
Items from right bucket are not removed when value from Workstream is changed.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2020 06:26 AM
Hi,
You can create an onChange client script (https://docs.servicenow.com/bundle/orlando-application-development/page/script/client-scripts/concep...) for your workstream field, that when changed, it clears the value from your list.
g_form.clearValue('roles_field');
Replace "roles_field" with the name of your roles list field.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2020 06:26 AM
Hi,
You can create an onChange client script (https://docs.servicenow.com/bundle/orlando-application-development/page/script/client-scripts/concep...) for your workstream field, that when changed, it clears the value from your list.
g_form.clearValue('roles_field');
Replace "roles_field" with the name of your roles list field.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2020 11:28 AM
Hi,
I just wanted to check-in on this and see how you're doing.
If my reply above helped answer or guide you correctly, please mark it as Helpful & Correct.
Thank you!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2021 10:43 AM
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var collectorName = 'cloud_application_ownership_confirmation'; //Name of the table
var myListCollector = g_list.get(collectorName);
var selectedOptions = g_form.getValue(collectorName).split(',');
if ((selectedOptions != "") && (selectedOptions.length > 0)) {
//Remove items
var index = 0;
for (var i = 1, leng = selectedOptions.length + 1; i < leng; i++) {
myListCollector.removeItem(selectedOptions[selectedOptions.length - i]);
index++;
alert(" ** changed in portal ***");
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2020 12:23 PM
Thanks! It's working now.