The CreatorCon Call for Content is officially open! Get started here.

How to filter a reference variable through client script

Ak8977
Tera Expert

there were two variable called contractor and manager, contractor is of yes or no type. and manger is of reference type. if we select yes in the contractor then only the users whose mail id contains "@xyz.com" need to be shown in the manager field.

1 ACCEPTED SOLUTION

Vishal Birajdar
Giga Sage

Hello @Ak8977 

 

You just use Advanced reference qualifier on "Manager" variable like below & no need to write script include and client script : 

 

Note : Use your variable backend name wherever necessary

 

javascript: var query;
if(current.variables.contractor == 'Yes'){
 query = "emailLIKE@xyz.com";
}

 

VishalBirajdar_0-1695984383141.png

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

View solution in original post

7 REPLIES 7

Hello @Vishal Birajdar ,
thank you very much. It works for me.

Satyapriya
Mega Sage

Hi Vishal,

 Current.variables.variable_name is not working.

Instead of that we should use 

javascript: var query;
if(current.getValue('u_contractor') == 'Yes'){
query = "emailLIKE@example.com";
}

Satyapriya
Mega Sage

Hi @Ak8977

Is it working perfectly as per your requirement.