- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2017 12:51 PM
Hi,
I have two reference fields that are for users, and I would like for the second reference field not to accept the same value that has been chosen in the first reference field.
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2017 01:50 PM
Please have this onChange() client script on second reference field.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var first_user = g_form.getValue('first reference field name'); //Update the field name here
if(first_user == newValue)
{
alert('User can not be the same');
g_form.clearValue('second reference field'); //Update the field name here
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2017 01:22 PM
Hi Eliana
Is this on a catalog item and are they having same names? Because you should not get this issue if they are difference variable names.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2017 01:31 PM
Hi Venkat,
This field are on a change form and one is assigned to and the other one is validator and they are both using sys_user table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2017 01:42 PM
Eliana,
You can get this done by using "On Change" or "On Submit" client scripts. What is the field values of the two fields ? I will give you a sample script which you can use.
~Raghu.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2017 01:28 PM
Eliana,
You can add a " On change " client script on the second field.
Read the value from both the reference fields and add a if condition.
if(first value == second value)
{
//script
if you want alert or clear the value
}
~Raghu.