Remove row on MVRS is not updating in reference variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 01:11 AM - edited 11-01-2023 01:12 AM
Hi Team,
We are using a list collector variable based on selection under this variable, new rows are being added to the MVRS. If I'm trying to remove a row by clicking on x, it will remove record from MVRS table but not from the reference. Please help.
Regards,
Ash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 04:48 AM
The tricky part about this is detecting when the x icon has been clicked. I have used an onLoad Catalog Client Script to do this. This example was at the Catalog Task level, so there's an opening if statement to determine if it is the catalog task on which the MRVS appears. Obviously you won't need this if you are referring to the Catalog Item view or RITM.
function onLoad() {
if(g_form.getValue('short_description') == "Procurement Assessment"){
var mrvs = g_form.getValue('network_gear_model_mrvs'); //internal name of MRVS
var obj = JSON.parse(mrvs);
for (var i = 0; i < obj.length + 5; i++) {
document.getElementsByClassName('btn-sm multi-row-delete-row')[i].addEventListener("click", function(){
g_form.setValue('v_row_deleted', 'Yes');
});
}
}
}
I don't recall why I'm iterating for the number of MRVS rows + 5 - maybe this is to account for adding rows before deleting them? The idea is this 'watches' for the icon to be clicked, then updates a Catalog Item variable. Then you can have an onChange Catalog Client Script to reset this variable then loop through the remaining contents of the MRVS to push the variable value that contains the list collector value to an array and set the value of the list collector variable to the joined array.
Here's other possible solutions:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 09:11 PM - edited 11-03-2023 12:36 AM
Hi Brad,
I need this on Catalog item/ESC portal. Link is referring to create macro under widget, will you please guide on same?