Restrict the user not to select the same his name in the Manager filed (Reference field)

Community Alums
Not applicable

Hi All, 

Below is the requirement need suggestions.

On the form, if there is no manager mapped for the 'requested for' then the user gets an option to select the manager name manually.

Here the manager field is a reference type. in this field, we need to restrict the users to choose the same as in the requested for field.

find_real_file.png

Need suggestion not to select the same name in the manager field.

 

 

 

Regards, 

Vinod.

3 REPLIES 3

Jaspal Singh
Mega Patron
Mega Patron

You can try below onChange() Catalog Client script that works on change of manager field.

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

var requestedfor=g_form.getValue('requested_for');//replace requested_for with correct variable name

var manageris=g_form.getValue('manager');//replace manager with correct variable name of manager

if(requestedfor==manageris)
{
alert('Manager cannot be same as Requested For');
g_form.setValue('manager','');//replace manger with correct variable name of manger
}

}

Community Alums
Not applicable

Hi, 

 

I tried the above script, don't know its not working for me.

 

But i tried with the ui policy 

the condition is requested for is same as manager then clear the value and show error message.

Thank you for the quick response.

 

 

Regards, 

Vinod.

Strange.

Are you sure about variable names. You had to replace above in script.

But fine you got it working via UI policy. Kindly close the thread.