- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2021 10:48 AM
Hi Team,
I am using a multi row variable set in a form as below. "Item name" is a lookup select box variable and i wanted to set the "Location to deliver" field mandatory in the form if the item name is Other.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2021 11:16 AM
Since it looks like you are using Service Portal, first create an onLoad Catalog Client Script on the Record Producer/Catalog Item (not within the MRVS) so that you have access to variables on the Catalog Item from a script within 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;
}
}
Next create an onChange Catalog Client Script within the MRVS when the Item Name variable changes. This script will work in both the native UI and Service Portal.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue == 'other'){//replace with the correct value
if(this){//Service Portal method
this.cat_g_form.setMandatory('location_to_deliver', true);//replace with the correct variable name
}
else{//native UI method
parent.g_form.setMandatory('location_to_deliver', true);
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2021 11:01 AM
Hi,
You can create a onChange client script in your multirow variable set onChange of Item Name variable :
use OnChange script as below:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newvalue == 'other'){
if(parent.g_form){
parent.g_form.setMandatory('location_to_deliver', true);
}
}
}
for the same approach please check below link:
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2021 11:16 AM
Since it looks like you are using Service Portal, first create an onLoad Catalog Client Script on the Record Producer/Catalog Item (not within the MRVS) so that you have access to variables on the Catalog Item from a script within 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;
}
}
Next create an onChange Catalog Client Script within the MRVS when the Item Name variable changes. This script will work in both the native UI and Service Portal.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue == 'other'){//replace with the correct value
if(this){//Service Portal method
this.cat_g_form.setMandatory('location_to_deliver', true);//replace with the correct variable name
}
else{//native UI method
parent.g_form.setMandatory('location_to_deliver', true);
}
}
}