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

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

Searches classic (legacy) alert conditions in their NRQL-converted format. Supports optional filtering by name, policy, or source product and cursor-based pagination.

## 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 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 under this policy ID.                                                                                                                  | `"2000002"`                                                                                                                                                                                                                            |
| **sourceProduct** | List   | **Optional.** Filter to conditions converted from these source products. One or more of `APM`, `BROWSER`, `INFRASTRUCTURE`, `MOBILE`, `NRQL`, `SERVERS`, or `SYNTHETICS`. | `["APM", "MOBILE"]`                                                                                                                                                                                                                    |
| **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.                                                                   | `"NTAtMTc4ODEwNzM1NzYxOA=="`                                                                                                                                                                                                           |
| **selectors**     | List   | **Optional.** JQ selectors to extract values from the response.                                                                                                           | ```yaml selectors:   - name: nrqlConditions     expression: ".data.actor.account.alerts.asNrqlConditionsSearch.nrqlConditions"   - name: nextCursor     expression: ".data.actor.account.alerts.asNrqlConditionsSearch.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`. Each condition includes a `sourceProduct` field. `nextCursor` is `null` when there are no further pages. ```json {   "data": {     "actor": {       "account": {         "alerts": {           "asNrqlConditionsSearch": {             "nextCursor": null,             "totalCount": 1,             "nrqlConditions": [               {                 "id": "12135326",                 "name": "High Error Rate",                 "enabled": true,                 "policyId": "1543893",                 "type": "STATIC",                 "sourceProduct": "NRQL"               }             ]           }         }       }     }   } } ``` |

## Example

The following example finds classic conditions by name fragment.

| Workflow example                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ```yaml name: search_as_nrql_conditions description: Search classic conditions in NRQL format steps:   - name: searchAsNrqlConditions     type: action     action: newrelic.alerts.searchAsNrqlConditions     version: 1     inputs:       accountId: ${{ .workflowInputs.accountId }}       nameLike: "error rate"       selectors:         - name: nrqlConditions           expression: ".data.actor.account.alerts.asNrqlConditionsSearch.nrqlConditions"     next: end ``` |
