How to exclude the current user in the reference field.

Kvb Kiran
Tera Contributor

There is a catalog item.
It contains two reference field where we can choose users.
Second reference field only appears after filling the first reference field with a user.

The requirement: the user selected in the first reference should not appear in the second reference field.

 

So, I have tried adding a reference qualifier for the second reference field variable for that catalog item.

..........^sys_id!=javascript:current.variables.var_second_variable^EQ

 

the reference qualifier ends like this.

 

I have tried this in simple and advanced.


In simple
I have added a AND condition and choose
Sys_id    is not     javascript:current.variables.var_second_variable


However, this is not working. 

How else should I have written this reference qualifier to exclude the user available in the first reference field?

 

Note: the second reference field have more reference qualifiers to exclude certain location users

1 ACCEPTED SOLUTION

Hi @Kvb Kiran ,

 

javascript:'active=true^nameISNOTEMPTY^u_user_type!=Customer^ORu_user_typeISEMPTY^location.countryLIKENetherlands^sys_id!='+current.variables.your_variable_name

 

note it's ":" not ":";

 

and replace your_variable_name with your actual variable backend name

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

8 REPLIES 8

Chaitanya ILCR
Kilo Patron

Hi @Kvb Kiran ,

ChaitanyaILCR_1-1753357697241.png

use advance reference qualifier like this

javascript:'sys_id!='+current.variables.your_variable_name

note it's ":" not ":";

 

and replace your_variable_name with your actual variable backend name

 

if you still having issue please share your variable info details along with the form screenshot and highlight which value you are trying to exclude

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

 

 

So the current filter is like this.


active=true^nameISNOTEMPTY^u_user_type!=Customer^ORu_user_typeISEMPTY^location.countryLIKENetherlands^EQ

 

Can i add like this

active=true^nameISNOTEMPTY^u_user_type!=Customer^ORu_user_typeISEMPTY^location.countryLIKENetherlands^javascript: 'sys_id!=' +current.variables.your_variable_name^EQ

Hi @Kvb Kiran ,

 

javascript:'active=true^nameISNOTEMPTY^u_user_type!=Customer^ORu_user_typeISEMPTY^location.countryLIKENetherlands^sys_id!='+current.variables.your_variable_name

 

note it's ":" not ":";

 

and replace your_variable_name with your actual variable backend name

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

I also have to change to location to the below
United States (USA).

This location word has spaces in between; will your script accept it?

javascript:'active=true^nameISNOTEMPTY^u_user_type!=Customer^ORu_user_typeISEMPTY^location.countryLIKEUnited States (USA)^sys_id!='+current.variables.your_variable_name

like this? 

 


After changing the reference qualifier to the below

javascript:'active=true^nameISNOTEMPTY^u_user_type!=Customer^ORu_user_typeISEMPTY^location.countryLIKENetherlands^sys_id!='+current.variables.your_variable_name

i am getting lot more users that this reference qualifier doesn't suites.