- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hello, community! I'm trying to sum variables (Value) within MRV and send that sum to a variable (Sum) outside of MRV.
I developed this client script within the record producer, but it's not working:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
var mrvsRows = g_form.getValue("nota_fiscal");
if (!mrvsRows) {
g_form.setValue("sum", 0);
return;
}
var rows = JSON.parse(mrvsRows);
var sum = 0;
for (var i = 0; i < rows.length; i++) {
var cost = rows[i]["value"];
if (cost) {
sum += parseFloat(cost) || 0;
}
}
g_form.setValue("sum", sum);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
this link has approach and you can enhance
Populate field outside MRVS with a total sum of fields inside MRVS
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
3 hours ago
this link has approach and you can enhance
Populate field outside MRVS with a total sum of fields inside MRVS
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