How to use onchange client script in multi row variable set

Nikita Singh
Giga Expert

Hi,

I want to see i3 as cpu selected and "total estimation cost is 300" in total_estimated_cost column if i select the choice as i3 in CPU field.

I want to use onChange client script to do this.

Here i have made:

Record producer: Estimation RP

Mutli row variable set: Disc size

pls help

 

find_real_file.png

 

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Not quite understand your requirement of why to do this. Though it is possible to onLoad and also onChange outside the MRVS, to fill rows in the MRVS.

Look at example script below. Obviously, you have to change the variable names, mrvs name. Maybe you also have to do something with labels/values. Though basic script works (= tested).

function onChange(control, oldValue, newValue, isLoading) {
	
	if(isLoading || newValue == '') {
		return;
	}

	var rowObj = [];
	rowObj.push(
		{
			"actions": "",
			"mrvs_variable_1": g_form.getValue('name_of_variable_you_are_trying_push')
		}
	);

	g_form.setValue('name_of_your_mrvs', JSON.stringify(rowObj));

}

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

5 REPLIES 5

Hi Mark,

 

Lets take the number is a reference field, when you select the number reference field is 123 the cart should be yes by using onChange client script. Please let me know the details of scripting.

Number is Reference field

Cart is single line text.

 

Thanks,

Mahesh R