The CreatorCon Call for Content is officially open! Get started here.

Get values from MRVS

miyu
Tera Guru

Is there any way to get values from MRVS?
Specifically, I would like to have a record producer variable automatically populated with the result of a calculation based on the following MRVS values.
In the screenshot below, I want to multiply the "金額" and "課金単位数" and set the result of adding each to the "利用料金" variable.
In this screenshot, we see
In this screenshot, 500 x 1 + 600 x 2 = 1,700, so we need to set 1,700 to the "利用料金" variable.
Can I do it?

find_real_file.png

6 REPLIES 6

hi @Vaishnavi can you also help me i want to get a value from MRVS and set the value into other variable with comma separated using of catalog client script

 

 

Willem
Giga Sage
Giga Sage

Hi Miyu,

Have a look at an article I wrote about MRVS here:

https://community.servicenow.com/community?id=community_article&sys_id=f911162e1b6e1054d2ccea89bd4bc...

 

In the comments I explain your use case to, from a MRVS value change, set a value on one of the main variables:

On the Multi Row Variable Set use the following on an onChange script on the Variable you want as the trigger. In my case the employee_salary:

function onChange(control, oldValue, newValue, isLoading) {
	if (isLoading || newValue == '') {
		return;
	}
	if(parent.g_form){
        parent.g_form.setValue('salary', newValue);
    }
}

 

So in your case you should have an onChange for both the column that contains 500 and 600 as well as the 1 and 2. When you chage eiter of the values for those columns or add a new row you can update the total (in my code 'salary').

 

Hope this helps! Feel free to check out the Article and if it helped, please mark the article as helpful as well 🙂