How to create onChange Client Script against Multi-Row Variable Set?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2025 12:56 PM
I'm looking for a way to create an onChange catalog client script (employee center request) to watch over the row values.
The Multi-Row variable set has a field called "Amount" that will be added on each input and outside of it there's a field called "Total Amount" that should be updated every time a row is added.
Anyone has been on a similar requirement? Any idea works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2025 10:58 PM
Hello @AndresGT1
Catalog Client Script
Type: onChange
Applies to Variable: your MRVS variable (e.g. mrvs_items)
Applies on: Catalog Client Script (not MRVS client script)
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === oldValue) {
return;
}
try {
// Get the MRVS JSON
var mrvsData = g_form.getValue('mrvs_items');
var total = 0;
if (mrvsData) {
var rows = JSON.parse(mrvsData);
// Loop through each row and sum the Amount values
rows.forEach(function(row) {
var amount = parseFloat(row.amount || 0);
if (!isNaN(amount)) {
total += amount;
}
});
}
// Set the total in the Total Amount field
g_form.setValue('total_amount', total);
} catch (e) {
console.log('Error calculating total amount: ' + e.message);
}
}
Pls mark my solution as accept, if you find it helpful and give thumbs up.
Regards,
Samaksh Wani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2025 04:58 AM
Hi @AndresGT1 ,
Please check below link this will help you
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2025 05:04 AM
Additionally I also tried same thing in my PDI and it is working fine for me
I created a Variable set
Inside that I created a Multi row variable
I also created a client script which works onLoad on multirow variable
and Add below script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
alert("Here" + g_form.getValue("IO:05a554759374f2509305f520ed03d618"));
}
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2025 04:59 AM
This post shows how to watch for MRVS changes on Service Portal / ESC
