Wont submit if the user is already inactive Service Catalog

Not applicable

Hello, 

Want to know how to create client script if Active Field is false then, populate error/info message that user already made inactive and not able to submit the request. Thank you in advance.

3 ACCEPTED SOLUTIONS

Danish Bhairag2
Tera Sage

Hi @Community Alums ,

 

Instead of creating client script you can put a filter of Active is true in Requested For field in your form which will only display active users. You can go that requested for variable & under Type specification u can add 1 filter condition.

 

Thanks,

Danish

 

View solution in original post

Danish Bhairag2
Tera Sage

@Community Alums 

 

Attaching screenshot for your reference.

 

DanishBhairag2_0-1699514688160.png

 

Thanks,

Danish

 

View solution in original post

Anand Kumar P
Tera Patron

Hi @Community Alums ,

Use below script

function onSubmit() {
    var activefield = g_form.getValue('active');
    if (activefield === 'false') {
        g_form.addErrorMessage("You cannot submit the request for an inactive item.");
        return false; 
    }
    return true;
}

 

AnandKumarP_0-1699514868289.png

 

Please mark it as solution proposed and helpful if it serves your purpose.

Thanks,

Anand

 

View solution in original post

3 REPLIES 3

Danish Bhairag2
Tera Sage

Hi @Community Alums ,

 

Instead of creating client script you can put a filter of Active is true in Requested For field in your form which will only display active users. You can go that requested for variable & under Type specification u can add 1 filter condition.

 

Thanks,

Danish

 

Danish Bhairag2
Tera Sage

@Community Alums 

 

Attaching screenshot for your reference.

 

DanishBhairag2_0-1699514688160.png

 

Thanks,

Danish

 

Anand Kumar P
Tera Patron

Hi @Community Alums ,

Use below script

function onSubmit() {
    var activefield = g_form.getValue('active');
    if (activefield === 'false') {
        g_form.addErrorMessage("You cannot submit the request for an inactive item.");
        return false; 
    }
    return true;
}

 

AnandKumarP_0-1699514868289.png

 

Please mark it as solution proposed and helpful if it serves your purpose.

Thanks,

Anand