Getting the Sum of all values from an MRV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2020 10:44 AM
Hello everyone
what i am trying to figure out is how to get the Sum total of all values entered in a MRV to be async on the form before submitting.
I am created an expense form for employees to fill out and would like to have their totals to be disabled before they submit their form.
I was able to figure out how to get the totals after submitted the form by added a Script on the Record Producer to total up all values:
However i am not able to make this work in a BR which i believe is the best way to do it.
This is a very basic screen but you will get the idea
Here what i have so far in my Business Rule but this is coming from another posting i saw:
My table for the Recorder Producer is called:
u_tester
Variables are:
u_name
u_total
MRV internal name is:
test
Variable inside of the MRV is:
amount
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2020 11:22 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2020 11:44 AM
Okay,
1- First go to "sc_multi_row_question_answer" table by typing sc_multi_row_question_answer.LIST in left filter navigator.
2 - Filter the record with applicable question, by right click and click show matching
3- Right click on filter and copy query( we will use in script). screenshot below
Could you run below in background script and check if you are able to print total
var current = new GlideRecord("u_tester");
if(current.get("90d378ff2f2860106f36e36ef699b695")){ // replace sys_id with a record sys_id in u_tester table
var grMRVSAnswer = new GlideRecord('sc_multi_row_question_answer');
grMRVSAnswer.addEncodedQuery('parent_id=' + current.getUniqueValue() + '^item_option_new=0f9338ff2f2860106f36e36ef699b60e'); // replace "item_option_new=0f9338ff2f2860106f36e36ef699b60e" with query copied in step 3
grMRVSAnswer._query();
var totalInt = 0;
while(grMRVSAnswer._next()) {
if(grMRVSAnswer.value != '') {
var amountInt = grMRVSAnswer.value;
totalInt = parseFloat(totalInt) + parseFloat(amountInt);
}
}
gs.log(totalInt);
}
Let me know results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2020 07:24 AM
where do i find the log for this

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2020 10:47 AM