Build a reference qualifier to show users who are not owners

Community Alums
Not applicable

Hi All,

 

Having a requirement that, 

On catalog form we have a fields like 

> Select the dl - (reference to DL table where we have owner, member) 

> Select user to add owner - reference to user table

 

here in the select user filed want to add a reference qualifer that validate the users data and show only the user who are not as owners of the selected Dl. 

 

Stucked here on proceeding further to how to keep this validation. Any suggestions. 

 

Thanks inadvance. 

1 ACCEPTED SOLUTION

J Siva
Tera Sage

Hi @Community Alums 
You can acheive this by using "sys_idNOT IN" operator in the ref qualifier.
1. Create one varibale to store the sys ids of the current owners (Hidden variable)

2. Create new variable and in the ref qualifier add the below script.

javascript:"active=true^sys_idNOT IN"+current.variables.approvers_sys_id;

 

Sample:

1. Catalog variables

JSiva_0-1742982762849.png

 

2. 

JSiva_1-1742982799000.png

3. Output:

JSiva_2-1742982850004.png

Hope this helps.
Regards,
Siva

 

View solution in original post

11 REPLIES 11

AakashG2525
Giga Contributor

Hi @Community Alums,

Hope you are doing well.

 

Proposed Solution

In order to show only those users in the 2nd Field who are not the owners or not in the DL Table (where you have the list of owners), you have to use the Reference Qualifier where you will call the Non-Client Callable Script Include which will contains the validation code that will filter out the records which are not required (means the records match with the records available in the DL Table) and the rest will get visible in the 2nd Field.

 

Let me know if you need a script for this.

 

If you find this information/knowledge/solution helpful, please don't forget to mark my solution and reply as Helpful and Accepted.

 

Thanks 🙂

Aakash Garg

ServiceNow Developer

J Siva
Tera Sage

Hi @Community Alums 
You can acheive this by using "sys_idNOT IN" operator in the ref qualifier.
1. Create one varibale to store the sys ids of the current owners (Hidden variable)

2. Create new variable and in the ref qualifier add the below script.

javascript:"active=true^sys_idNOT IN"+current.variables.approvers_sys_id;

 

Sample:

1. Catalog variables

JSiva_0-1742982762849.png

 

2. 

JSiva_1-1742982799000.png

3. Output:

JSiva_2-1742982850004.png

Hope this helps.
Regards,
Siva

 

Rohit  Singh
Mega Sage

Hi @Community Alums 

 

Can You share the screenshot of DL record where you have owner field?

Ankur Bawiskar
Tera Patron
Tera Patron

@Community Alums 

what's the DL table? which field in it holds owner i.e. reference to sys_user?

something like this in advanced ref qualifier of Select User variable

javascript: 'sys_idNOT IN' + current.variables.dlVariableName.ownerField;

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader