Ticket Initiator should not be the project manager.

sai9845
Tera Contributor

If a user raise a service request it will be going for the project manager approval.

Here the user is having the project manager role too, then the approver has to be other person in the respective project. 

The system should not allow him to be as the project manager.

There has to be an alert like since the user and project manager are same pls select the other person from project for the approval.

1 REPLY 1

sai9845
Tera Contributor

I have written this On Change client script.

 

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

    var name = g_form.getValue('fullname');
    var gr = new GlideRecord('sys_user');
    gr.addQuery('user', project);
    var project = g_form.getValue('manager');


    if (name == project) {
        // alert('manager');

    } else {
        //alert(' else condition');
        g_form.clearValue('manager');
        alert('Please change the project manager');
        g_form.showFieldMsg('manager', 'Ticket Initiator and project manager should not be same. Pls select another manger from queue', 'error');
    }


}