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

Community Alums
Not applicable

Hi Anukar, 

 

Thanks for the response. 

DL means - Distribution list table. Here we are storing all the DL data with the name, owner and members 

 

tried the suggested reference qualifier as below

javascript: 'sys_idNOT IN' + current.variables.distribution_list_s.u_managedby;

> distribution_list_s - variable name 

>u_managedby - name of the filed refers to owner from the table. 

> This owner field is a glide list type field

its not working. Any further validation need to check. 

 

Thanks inadvance.

Hi @Community Alums 
Create one hidden field to store the sys ids. Then use that field value.

Hi @Community Alums ,

 

You can create one string variable (u_owner_list) which you can hide in that string variable you can store the sys_id of u_managedby by using dependent variable (distribution_list_s) and dot walk to store owner. 

 

And now in the  the select user refence field add this reference qualifier.

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

 

If my response helped, please hit the Thumb Icon and accept the solution so that it benefits future readers.

 

Regards,
Rohit

@Community Alums 

try with following reference Qual.

javascript: 'sys_idNOT IN' + (current.variables.distribution_list_s.u_managedby ?
current.variables.distribution_list_s.u_managedby.join(',') : '');

 

@Community Alums 

then try this if u_managedby is glide list

javascript: 'sys_idNOT IN' + current.variables.distribution_list_s.u_managedby.toString();

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