- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2025 01:28 AM - edited ‎07-04-2025 01:29 AM
I am working on a script where i need to update a list collector field when a row is deleted in MRVS.
My catalog is defined in following format:
1. List collector field (outside any variable set) > This allows to select multiple users
2. MRVS with 3 variables defined : reqFor, assetname, serialnumber;
When user is selected, MRVS adds row with details (reqFor, assetname, serialnumber) of selected user. If user is removed, MRVS is getting updated. //working
If I remove a row from MRVS, list collector should be updated. Basically, if i remove any row, user removed from MRVS should also be removed from list field. That is both list collector and MRVS should be in sync. //This is not working.
*I want this onchange to execute only when row is removed*
The resources available in community talks about script in widget but I need that in my client script. To start with, I am trying an onchange client script in MRVS with field value of reqFor. But, I am not getting the alert itself.
any suggestion on how i can achieve this. ?
var requestedFor = g_form.getValue('list_the_existing_machine_name');// MRVS internal name
var parser = JSON.parse(requestedFor);
alert(parser.length);//NO ALERT
/*var valueToRemove ='';
var userListCollector = parent.g_form.getValue('my_list_collector');
var listArr = userListCollector.split(',');
var index = listArr.indexOf(valueToRemove);
if(index! == -1){
listArr.splice(index,1);
parent.g_form.setValue(userListCollector, listArr.join(','));*/
Does onchange script work at all when row is removed ? I tried giving a simple alert on change of variable in MRVs and i did not get that alert as well.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2025 02:02 AM
You cannot easily determine using client script etc on MRVS whether row was added/removed.
you can determine if row is added or removed using this workaround and then accordingly modify the outside list collector variable
MRVS detect when a row is removed or deleted
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2025 02:02 AM
You cannot easily determine using client script etc on MRVS whether row was added/removed.
you can determine if row is added or removed using this workaround and then accordingly modify the outside list collector variable
MRVS detect when a row is removed or deleted
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader