Setting up automatic group membership
Overview
Section titled “Overview”Dynamic membership adds users to a Group automatically, based on their profile fields, such as job title, department, or location. Instead of adding users by hand, you write a query, and the query keeps the group’s membership up to date.
Setting up a dynamic group
Section titled “Setting up a dynamic group”- In the navigation pane, select Manage > Groups.
- Open the Group that you want to configure, or create one.
- Under Membership, select the Dynamic tab to open the query editor.
- In the Query field, enter your query:
fields.fieldname, followed by an operator and a value in single quotes. The most common field isfields.title(job title), but you can use any user profile field. See Query syntax and Examples. - Save the query.
The matching users appear on the Dynamic tab of the Group. The Group can take a moment to refresh.
Query syntax
Section titled “Query syntax”Refer to a field with dot notation: fields.fieldname. Replace fieldname with the field key from the user profile, for example fields.title, fields.department, or fields.location.
Comparison operators
Section titled “Comparison operators”| Operator | Meaning | Example |
|---|---|---|
== | The field value matches exactly. | fields.title == 'Account Executive' |
contains | The field value contains the quoted text. | fields.title contains 'Sales' |
!= | The field value does not equal the quoted text. | fields.department != 'Engineering' |
Logic operators
Section titled “Logic operators”| Operator | Meaning | Example |
|---|---|---|
and | Both conditions must be true. | fields.department == 'Sales' and fields.location == 'New York' |
or | Either condition can be true. Use it to match several values. | fields.title == 'Account Executive' or fields.title == 'Sales Rep' |
Examples
Section titled “Examples”Match a single job title
Section titled “Match a single job title”Add all users whose title is exactly “Account Executive”:
fields.title == 'Account Executive'Match several job titles
Section titled “Match several job titles”Add users with any of several titles by chaining conditions with or:
fields.title == 'Account Executive' or fields.title == 'Sales Rep' or fields.title == 'Regional Sales Manager'Match by department and location
Section titled “Match by department and location”Add users who are in the Sales department and located in Chicago:
fields.department == 'Sales' and fields.location == 'Chicago'Exclude a group of users
Section titled “Exclude a group of users”Add all users except those in the Engineering department:
fields.department != 'Engineering'Troubleshooting
Section titled “Troubleshooting”No users are added, although the query looks valid
Field values in a query must match the values stored in user profiles exactly, including capitalization. A query that uses == is case-sensitive.
- Open a user profile that should match your query, and note the exact field value.
- Change your query to match that value exactly, or change
==tocontainsto allow for differences in capitalization. - Save the query, and give the Group a moment to refresh.
When it is fixed, the matching users appear on the Dynamic tab of the Group.
More users are added than expected
A broad contains value matches every field value that includes that text. For example, contains 'Manager' matches "Account Manager", "Marketing Manager", and every other title with that word.
- Find the
containsconditions in your query that are too broad. - Change
containsto==for each condition that should match an exact title. - Save the query, and check the Users tab to confirm that the membership is correct.
When it is fixed, the matching users appear on the Dynamic tab of the Group.
The query field shows an error, or the query does not save
A syntax error stops the query from saving. The most common causes are missing single quotes, uppercase operators, and stray characters.
- Make sure that every text value is in single quotes, for example
'Account Executive'. - Make sure that every operator is lowercase:
and,or,contains. - Remove line breaks, extra spaces, and special characters from the query.
- Enter the query again, and save it.
When it is fixed, the query saves without an error, and the Dynamic tab shows the matching members.
What’s next
Section titled “What’s next”- Setting up group targets for campaigns: show different banners to each Group.
- Assigning business cards in Routing: give each Group its own business card.

