Formulating and testing a membership query

This document explains how to formulate and test your membership queries to ensure the correct employees are returned.

Before you begin

Perform the following tasks before proceeding with the information on this page:

Formulating and testing your query

Membership queries take the form of target_field condition, and are formatted as Common Expression Language (CEL) expressions.

The following example shows how to check for a specific value in a user.addresses field using the exists() CEL function:

user.addresses.exists(ad, ad.locality==`Sunnyvale`)

The exists() macro is used to create membership queries for fields of type list.

Here is an example of checking multiple values, (building) area and building_id, in a single list entry:

user.locations.exists(loc, loc.area==`Sunnyvale` && loc.building_id==`Building 1`)

Testing membership queries

To test your membership queries, you can use the simple query builder.

Testing queries with the simple query builder

The simple query builder allows you to use drop-down menus and text fields to enter and test a query. After you are sure the membership query returns the correct results, you can create the corresponding CEL queries with the dynamic groups API.

What's next

After you test your membership query, you can use it when creating a group. For more information, refer to Creating a dynamic group.