---
source_url: https://www.pubnub.com/docs/analytics/decisions/create-decision-from-query
title: Create a Decision from a query
updated_at: 2026-09-30T07:20:08.000Z
---

# Create a Decision from a query

## Documentation index

To discover more PubNub resources:

1. Fetch [PubNub's llms.txt](https://www.pubnub.com/llms-full.txt) for a list of available pages in Markdown format.
2. Identify relevant URLs from that index.
3. Fetch the target pages.

Do not assume a path exists, always check the index first.

This guide shows you how to connect a saved Query Builder query to a Decision so that Illuminate can trigger actions based on query results.

:::tip Preview
Query Builder is in preview. Features and functionality may change.
:::

## Before you start

Before starting, confirm you have:

* A saved Query Builder query. See [Create a query from a predefined template](https://www.pubnub.com/docs/analytics/decisions/create-predefined-query.md) or [Create an advanced query](https://www.pubnub.com/docs/analytics/decisions/create-advanced-query.md).
* Access to Illuminate in the [Admin Portal](https://admin.pubnub.com/).

For an overview of how queries connect to Decisions and the difference between the two creation paths, see [Query Builder](https://www.pubnub.com/docs/analytics/decisions/query-builder.md).

## Open the Decision creator

1. Open your saved query in Query Builder.
2. Click **Create Decision**.

:::note Button visibility
The **Create Decision** button only appears after you save the query.
:::

1. Choose one of the two paths:

   * **Predefined**: available for predefined query templates. Illuminate creates the Decision automatically.
     * **Create from scratch**: opens a blank Decision for full manual configuration.

## Use a predefined Decision

Select **Predefined**. Illuminate creates the Decision immediately with:

* A Decision table built from the query
* Conditions preconfigured from the query output
* Default actions based on the use case (for example, reward or flag actions for Top N or spam queries)

After creation, you can:

* Edit rules and thresholds
* Edit action configurations
* Activate the Decision

To return to the query at any time, click the query name displayed below the Decision title.

For activation steps, see [Create a Decision](https://www.pubnub.com/docs/analytics/decisions/create-decisions.md#activate).

## Create a Decision from scratch

Select **Create from scratch**. The Decision opens with a blank configuration.

1. Enter a name for the Decision. Add an optional description.
2. Configure conditions by clicking **Select query** and choosing a saved query. The available data fields correspond to the fields defined in the query output, for example `user`, `message`, `channel_count`, or `total_count`.
3. Add one or more actions. For action types and configuration options, see [Decisions](https://www.pubnub.com/docs/analytics/decisions.md#actions).
4. Create rules that match conditions to actions. For each rule, set the condition values using the query output fields and assign an action.
5. Activate the Decision. For activation steps, see [Create a Decision](https://www.pubnub.com/docs/analytics/decisions/create-decisions.md#activate).

Illuminate begins evaluating the query on the configured frequency. When a rule matches, the assigned action fires.

Last updated at: 2026-09-30T07:20:08.000Z
