---
title: Search NRQL conditions
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/newrelic/alerts/newrelic-alerts-search-nrql-conditions
---

The action identifier is `newrelic.alerts.searchNrqlConditions`.

Searches NRQL alert conditions (static or baseline) with optional filtering by name, policy, NRQL query text, or terms operator. Supports cursor-based pagination. Omitting all filters returns all conditions in the account.

## Inputs

The following table describes all available input fields for this action.

| Input             | Type   | Description                                                                                                                                                           | Example                                                                                                                                                                                                                            |
| ----------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **accountId**     | Int    | **Required.** The New Relic account to search NRQL conditions in.                                                                                                     | `123456`                                                                                                                                                                                                                           |
| **name**          | String | **Optional.** Filter to conditions with this exact name.                                                                                                              | `"High error rate"`                                                                                                                                                                                                                |
| **nameLike**      | String | **Optional.** Filter to conditions whose name contains this substring.                                                                                                | `"error rate"`                                                                                                                                                                                                                     |
| **policyId**      | String | **Optional.** Filter to conditions attached to this alert policy.                                                                                                     | `"2000002"`                                                                                                                                                                                                                        |
| **nrqlQuery**     | String | **Optional.** Filter to conditions with this exact NRQL query text.                                                                                                   | `"SELECT count(*) FROM TransactionError WHERE appName = 'MyApp'"`                                                                                                                                                                  |
| **nrqlQueryLike** | String | **Optional.** Filter to conditions whose NRQL query text contains this substring.                                                                                     | `"TransactionError"`                                                                                                                                                                                                               |
| **termsOperator** | String | **Optional.** Filter to conditions whose threshold term uses this operator. One of `ABOVE`, `ABOVE_OR_EQUALS`, `BELOW`, `BELOW_OR_EQUALS`, `EQUALS`, or `NOT_EQUALS`. | `"ABOVE"`                                                                                                                                                                                                                          |
| **cursor**        | String | **Optional.** Pagination cursor from a prior call's `nextCursor` output. Leave blank on the first call.                                                               | `"eyJsYXN0SWQiOiI3NjU0MzIxIn0="`                                                                                                                                                                                                   |
| **selectors**     | List   | **Optional.** JQ selectors to extract values from the response.                                                                                                       | ```yaml selectors:   - name: nrqlConditions     expression: ".data.actor.account.alerts.nrqlConditionsSearch.nrqlConditions"   - name: nextCursor     expression: ".data.actor.account.alerts.nrqlConditionsSearch.nextCursor" ``` |

## Outputs

The following table describes all output fields returned by this action.

| Output           | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **success**      | Boolean | `true` when the step executed without error.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| **errorMessage** | String  | Error message on failure. `null` on success.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| **data**         | Map     | NerdGraph response. Use `selectors` to extract `nrqlConditions`, `nextCursor`, or `totalCount`. Baseline conditions additionally include `baselineDirection` and `signalSeasonality` in each result. `nextCursor` is `null` when there are no further pages. ```json {   "data": {     "actor": {       "account": {         "alerts": {           "nrqlConditionsSearch": {             "nextCursor": null,             "totalCount": 1,             "nrqlConditions": [               {                 "id": "7654321",                 "name": "High error rate",                 "type": "STATIC",                 "enabled": true,                 "policyId": "2000002"               }             ]           }         }       }     }   } } ``` |

## Example

The following example finds NRQL conditions attached to a policy by name fragment.

| Workflow example                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ```yaml name: search_nrql_conditions description: Search NRQL alert conditions steps:   - name: searchConditions     type: action     action: newrelic.alerts.searchNrqlConditions     version: 1     inputs:       accountId: ${{ .workflowInputs.accountId }}       policyId: ${{ .workflowInputs.policyId }}       nameLike: "error rate"       selectors:         - name: nrqlConditions           expression: ".data.actor.account.alerts.nrqlConditionsSearch.nrqlConditions"     next: end ``` |
