How to clear a Variable in the main form when add new value on MRVS?

jacobo
Tera Contributor

HI All

 

I need to clear one variable when add a new row using MRVS

Is that posible?

 

1

jacobo_0-1727184330886.png

2

jacobo_1-1727184353598.png

3

jacobo_2-1727184371913.png

 

2 ACCEPTED SOLUTIONS

Brad Bowman
Kilo Patron
Kilo Patron

You can do this with an onSubmit Catalog Client Script that applies to the MRVS

function onSubmit() {
	parent.g_form.clearValue('slb_hardware_type');
}

It will be a bit more involved if you want to compare that the row added was for that Hardware type first.

View solution in original post

This version will work in both the native UI and Service Portal

function onSubmit() {
	if (this) { //Service Portal method
		this.cat_g_form.clearValue('slb_hardware_type');
	} else { //native UI method
		parent.g_form.clearValue('slb_hardware_type');
	}
}

For the portal method to work you'll also need an onLoad Catalog Client Script that applies to the Catalog Item, not the MRVS

function onLoad() {
	if (this) {//we only need to do this for Service Portal
		//We need to make the g_form object for the parent item available from the MRVS window
		this.cat_g_form = g_form;
	}
}

View solution in original post

7 REPLIES 7

Brad Bowman
Kilo Patron
Kilo Patron

You can do this with an onSubmit Catalog Client Script that applies to the MRVS

function onSubmit() {
	parent.g_form.clearValue('slb_hardware_type');
}

It will be a bit more involved if you want to compare that the row added was for that Hardware type first.

Hi Brad ,

 

the script doesnt work on  the portal view. the value on the main after submit doesnt clear the variable

 

function onSubmit() {
  
parent.g_form.clearValue('slb_hardware_type');
 
parent.g_form.setValue('slb_hardware_type','');
 
parent.g_form.clearOptions('slb_hardware_type')
}
 
I tried to use a diferent comand but it doest work on the poral
 
Do you have any idea abou it?
 
I appreciate your help
 
Regards

 

This version will work in both the native UI and Service Portal

function onSubmit() {
	if (this) { //Service Portal method
		this.cat_g_form.clearValue('slb_hardware_type');
	} else { //native UI method
		parent.g_form.clearValue('slb_hardware_type');
	}
}

For the portal method to work you'll also need an onLoad Catalog Client Script that applies to the Catalog Item, not the MRVS

function onLoad() {
	if (this) {//we only need to do this for Service Portal
		//We need to make the g_form object for the parent item available from the MRVS window
		this.cat_g_form = g_form;
	}
}

Youuu're ROCK!!!!!! 

 

Thank you