Articles on: Marketing Automation

Using the Query Builder / Common Queries

Using the Query Builder / Common Queries

Using the Query Builder

The query builder is a powerful ActiveDEMAND feature you can utilise to build workflow decisions, contact lists, dynamic blocks and more. The query builder allows you to segment your prospects and any related data and history quickly, accurately, and efficiently in order to get the most out of your marketing automation!

Query Structure

A query is structured into 3 levels; Blocks, Groups, and Filters. The query structure you use is very important to the result of the query itself. You can select filters using the drop down menu(s) inside the group.


Query builder using filters

All filters within a specific group are executed together as a single query. This means for the query to return results, each result must match all filters as a group. Place all filters within a single block when you want them to be checked together, and be dependent on each other.

The above query looks for contacts that have both submitted the form 'Contact Us' and have submitted a field in that form that is 'United States'.


Each group is run as a separate query, and the results of those queries are combined together with the operator specified. Use different groups or blocks when you want the filters to be checked independently.

Query builder combining filter groups

Above, the first group will look for a contact that Equals (or has participated in) the Campaign 'Test Campaign' while at the same time equals (or exists in) the Contact List 'Test List'.

The second group asks for a form submit to exist in general when displaying the results.

The result would be a list of contacts that have participated in campaign 'Test Campaign', that exist in list 'Test List', and that have submitted any form in your database.

If the Submitted Form query in Group 2 was inside Group 1 the form submission would have had to happen inside the campaign and the contact would have to be in the contact list specified.


Blocks work exactly the same as groups. Each block is executed as a separate independent query and the result sets are joined together using the operator you specify. If you create a query that says Block A AND NOT Block B, the final result set will be all results from Block A, that are not part of Block B.

Query Building in Different Contexts

You can use the query builder in different areas of ActiveDEMAND, including the workflow area.

Inside workflows you will find our decisions section. This section will have decision blocks that can be based on global context, campaign context, or current campaign context.

Global Query Context

The global query context will look for all records ever created in the database. The only limits to the result set will be defined by the query itself. The global query may look at contacts, or at contact history items.

Contact Lists and Dynamic Lead Scores always run in the global query context. Workflow Decisions have the option of running in this query context as well as other query contexts.

Reuse querys in campaign workflows

Campaign Query Context

This context will only look at contact history items and results that occurred within the specific campaign.

Workflow Decisions have an option of running in the campaign query context, if the workflow is part of a campaign. This is the only place this query context is used.


Current Campaign Step

Using query builder in campaigns

Common Queries

The Query Builder allows you to personalise and create powerful user journeys for your marketing initiatives.

Below are some examples of some common queries using the term 'eloqua'. This term can be replaced with any other term that would prove useful to your marketing strategy.

You may use these queries (or variations of these queries) to create contact lists, dynamic content blocks, workflow decisions and more!

Page Visit

If the contact has visited a page that contains 'eloqua' in its URL


Search for a name or term

Phone Calls

If the contact has called a call tracking number you have purchased in your account:

Query any history for a term or name

Live Chat

If a contact used the word 'eloqua' during a chat conversation:

Did a word occurre in a chat?

Referral Traffic

If the referral source contains 'eloqua' in the URL:

From a referral source?

Example of a referral source URL (without 'eloqua' in it):

using did not contain query

Custom field

If the organisation in the account has a custom field set. Examples: From a CRM or a manually set field.



If the contact has an IP address from Ohio:


If the contact has an organisation that is from Ohio:

Query builder for location

Accessing History Dates

Every contact history (form submit, webinar registration, email link click, etc) creates a Contact History object (which shows up on the Contact's timeline). If you are trying to query for a specific history that occurred at a specific time range, you will need to use at least two qualifiers: the history type and the created at.

Filter by dates or ranges

More Common Queries

Make it complex

Updated on: 23/09/2022

Was this article helpful?

Share your feedback


Thank you!