To populate value from LookUpSelect Box variable from MRVS to single line text variable outside MRVS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hi Team,
I have a LookUp Select Box variable named 'Plant' in PackSize MultiRow Variable set(MRVS).
Have a Single Line Text variable named 'PlantOutside' in Outside MRVS.
When user select a value for Plant from PackSize MultiRow Variable set, i want to autopopulate that value in my Single Line Text variable which is present outside MRVS.
I have tried the below OnChange Catalog Client script in PackSize MRVS level when the Plant variable changes,but i cannot able to set the value in single line text variable. Please help me
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
g_service_catalog does not (yet?) work to set values, you can only getValue. You can use a script like this:
if (this) { //Service Portal method
this.cat_g_form.setValue('v_manager', newValue);
} else { //native UI method
parent.g_form.setValue('v_manager', newValue);
}
If you are using Service Portal / ESS, this script is also needed onLoad of 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;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hi @Amrutha K V,
Since your requirement is to populate a variable outside the MRVS whenever the Plant value changes inside the MRVS, you can achieve this directly from the MRVS onChange Client Script without using an additional trigger variable.
Create an onChange Catalog Client Script on the Plant variable inside the MRVS:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || !newValue)
return;
try {
parent.g_form.setValue(
'plant_outside',
newValue
);
} catch (e) {
console.log(e);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
We have tried the above script and its not working as expected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
53m ago
You could use an onChange script from the catalog item itself and parse the value from the mrvs. Something like this could work:
var mrvsVal = JSON.parse(g_form.getValue('plant mrvs'));
var updatedValue;
for (var i = 0; i < mrvsVal.length; i++) {
if (mrvsVal[i].<list collector field name>) {
updatedValue = mrvsVal[i].<list collector field name>;
}
}
g_form.setValue('<PlantOutside variable>', updatedValue);