Restrict the user not to select the same his name in the Manager filed (Reference field)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2022 12:37 PM
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.
Need suggestion not to select the same name in the manager field.
Regards,
Vinod.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2022 12:43 PM
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
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2022 01:31 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2022 01:33 PM
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.