Copy variable 1(Reference) value to the other variable 2(list collector) on change of the variable

rajasekharteja
Tera Guru

Hello All,

 

I need to copy variable 1 ( reference) value to variable 2(watch list).

 

If user updates the variable 1 value then the value should get updated in the watch list field i.e.., the earlier value present in watch list variable should be removed and should be populated with the new value selected in the variable.

 

NOTE: Both variables are part of variable set.

 

Is creating 2 client scripts a better option or if there is any better approach please guide me on this.

 

Thanks,
Raj

15 REPLIES 15

Mehta
Kilo Sage
Kilo Sage

@rajasekharteja 

so if only variable 1 changes and that variable should be represent into variable 2 then only one onchange client script will be enough to handle this requirement. 

 

g_form.clearValue('variable2');
g_form.setValue('variable_name2', newValue);

 

The above script is the sample code that you can use.

 

Hello @Mehta 

 

Thanks for providing quick response.

 

The problem here is we cannot simple clear the value in Watch list variable as user can select multiple users along with these user's we need to populate the value selected in variable 1(Reference) if we user changes the value in variable 1 the value present in watch field(variable 2) should be removed and the remaining values should be present. 

 

 

Thanks,

I have used setvalue to map the value to the Watchlist variable but to remove the value I'm not getting what needs to be done/updated.

I will share a script logic in sometime.