How to populate an alert message when same values selected in multi variable set

Lally
Tera Contributor

Hi, can anyone help me with this

I have a multi variable set in catalog form , in that when same group field values are selected then an alert should be populated.

Thanks

1 ACCEPTED SOLUTION

Samaksh Wani
Giga Sage
Giga Sage

Hello @Lally 

 

 

 

var mrvs = g_service_catalog.parent.getValue('mrvs'); //MRVS internal name
if (mrvs.length > 2) {//native UI returns [] for empty MRVS value which causes a parsing error
    var obj = JSON.parse(mrvs);
    for (var i=0; i<obj.length; i++) {
        if (obj[i].variable_name = g_form.getValue('variable_name') {
            alert('Duplicate value');
            return false;
        }
}

 

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.

 

Regards,

Samaksh

View solution in original post

3 REPLIES 3

Mohith Devatte
Tera Sage
Tera Sage

Hello @Lally ,

So basically you have a field called group and you add a row with one group selected .Then you add a second row and if they select the same group you need to get an alert?

 

yes

 

Samaksh Wani
Giga Sage
Giga Sage

Hello @Lally 

 

 

 

var mrvs = g_service_catalog.parent.getValue('mrvs'); //MRVS internal name
if (mrvs.length > 2) {//native UI returns [] for empty MRVS value which causes a parsing error
    var obj = JSON.parse(mrvs);
    for (var i=0; i<obj.length; i++) {
        if (obj[i].variable_name = g_form.getValue('variable_name') {
            alert('Duplicate value');
            return false;
        }
}

 

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.

 

Regards,

Samaksh