How to show error message on multiple choice variable.

vinod9
Tera Expert

Hello Team

I have requirement on catalog item to show error message on multiple choice variable based on other variable.

When I select the "call meeting check box" and select the "select" choice in the multiple choice error has to display on multiple choice variable  like "when call meeting selected select should not be select"

Please find below screen shots for more details.


Check Box:

vinod9_0-1670512395020.png

 

Multiple Choice :

vinod9_1-1670512489413.png

 


@Gunjan Kiratkar 

@Mohith Devatte 

 

 

1 ACCEPTED SOLUTION

Okay,

Deactivate Catalog client script and 

In that case go with catalog UI policy as below :-

You can add OR condition if you want to add more conditions in below tab

 

GunjanKiratkar_0-1670517663414.png

 

Script :-

GunjanKiratkar_1-1670517713281.png

 

Execute if true :-

 

 

function onCondition() {
    g_form.showFieldMsg('please_select_the_choice', 'when call meeting selected select should not be select', 'error');

}

 

 

 

Execute if false

 

 

function onCondition() {

        g_form.hideFieldMsg('please_select_the_choice', true);
    
}

 

 

 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

View solution in original post

5 REPLIES 5

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @vinod9 ,

You can create OnChange Catalog Client script as below

GunjanKiratkar_0-1670515035909.png

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    //Type appropriate comment here, and begin script below
    if (newValue == 'true') {
        g_form.showFieldMsg('please_select_the_choice', 'when call meeting selected select should not be select', 'error');
    } else {
        g_form.hideFieldMsg('please_select_the_choice', true);
    }

}

 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

Hello @Gunjan Kiratkar 

Let me first thank you for your help!

vinod9_0-1670516955997.png

 

when I select call meeting(check box) and support(Multiple choice) then error has to display on "please select the choice"(Multiple choice variable).


I used your above code, after selecting " call meeting" it is showing error and hiding all the multiple choice values as shown below

vinod9_1-1670517254763.png


Expected behavior is, when I select "call meeting" and "select" then it has to show error.

*select means support value 

Okay,

Deactivate Catalog client script and 

In that case go with catalog UI policy as below :-

You can add OR condition if you want to add more conditions in below tab

 

GunjanKiratkar_0-1670517663414.png

 

Script :-

GunjanKiratkar_1-1670517713281.png

 

Execute if true :-

 

 

function onCondition() {
    g_form.showFieldMsg('please_select_the_choice', 'when call meeting selected select should not be select', 'error');

}

 

 

 

Execute if false

 

 

function onCondition() {

        g_form.hideFieldMsg('please_select_the_choice', true);
    
}

 

 

 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy