Filter condition for Reference qualifier

neharao
Giga Contributor

Hi all,

I have a requirement where in I have a field type 'List' for 'Approvers' which I need to filter based on users of current company and active users. The company part worked for me i.e. javascript: 'company=' + current.company' but how can I include an 'AND' condition in the same script to filter active users. Please find below the screenshot of the same.

find_real_file.png

Thanks,

Neha

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

You would do something like this:

javascript:'company='+current.company+'^active=true'

The whole point of the reference qualifier is to return an encoded query to the system. ^ is the default separate for "and". If you want to get a sample, go to a list of records and build the filter you want, then right click on the blue breadcrumbs at the top and select Copy Query to see what you've built using the condition builder.

 Reference: Docs: Encoded Query Strings

View solution in original post

5 REPLIES 5

Chuck Tomasi
Tera Patron

You would do something like this:

javascript:'company='+current.company+'^active=true'

The whole point of the reference qualifier is to return an encoded query to the system. ^ is the default separate for "and". If you want to get a sample, go to a list of records and build the filter you want, then right click on the blue breadcrumbs at the top and select Copy Query to see what you've built using the condition builder.

 Reference: Docs: Encoded Query Strings

How the code will be when I want only active =true but not current company Please give me reply I am searching for this But it's not working

When dealing with dynamic data like "not current company", you are going to need to use script to build an advanced reference qualifier. Please note that I am working with the docs team to fix this page. it should NOT use a global business rule, but rather a script include.

Create an advanced reference qualifier | ServiceNow Docs

The function must return an encoded query string.

Encoded query strings | ServiceNow Docs

it helped me a lot