---
title: Update a baseline NRQL condition
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/newrelic/alerts/newrelic-alerts-update-baseline-nrql-condition
---

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

Updates an existing baseline NRQL alert condition. Every field except `accountId` and `id` is optional — only the fields you provide are changed; omitted fields keep their current value.

## Inputs

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

| Input                         | Type    | Description                                                                                                                                                                                                                                             | Example                                                                                                                     |
| ----------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **accountId**                 | Int     | **Required.** The New Relic account that owns the condition.                                                                                                                                                                                            | `123456`                                                                                                                    |
| **id**                        | String  | **Required.** The ID of the baseline condition to update.                                                                                                                                                                                               | `"7654322"`                                                                                                                 |
| **name**                      | String  | **Optional.** New name for the condition. Omit to leave unchanged.                                                                                                                                                                                      | `"Abnormal response time"`                                                                                                  |
| **nrqlQuery**                 | String  | **Optional.** New NRQL query to evaluate. Omit to leave unchanged.                                                                                                                                                                                      | `"SELECT average(duration) FROM Transaction WHERE appName = 'MyApp'"`                                                       |
| **nrqlDataAccountId**         | Int     | **Optional.** Account to run the NRQL query against if different from `accountId`.                                                                                                                                                                      | `123456`                                                                                                                    |
| **enabled**                   | Boolean | **Optional.** Whether the condition is active. Set `false` to disable.                                                                                                                                                                                  | `true`                                                                                                                      |
| **baselineDirection**         | String  | **Optional.** New deviation direction. One of `UPPER_ONLY`, `LOWER_ONLY`, or `UPPER_AND_LOWER`. Omit to leave unchanged.                                                                                                                                | `"UPPER_ONLY"`                                                                                                              |
| **signalSeasonality**         | String  | **Optional.** New seasonality setting. One of `NEW_RELIC_CALCULATION`, `HOURLY`, `DAILY`, `WEEKLY`, or `NONE`. Omit to leave unchanged.                                                                                                                 | `"NEW_RELIC_CALCULATION"`                                                                                                   |
| **terms**                     | List    | **Optional.** Replaces the condition's thresholds. Omit to leave unchanged. Each entry: `priority` (`CRITICAL` or `WARNING`), `operator` (`ABOVE` only), `threshold`, `thresholdDuration` (seconds), `thresholdOccurrences` (`ALL` or `AT_LEAST_ONCE`). | `[{"priority": "CRITICAL", "operator": "ABOVE", "threshold": 30, "thresholdDuration": 300, "thresholdOccurrences": "ALL"}]` |
| **description**               | String  | **Optional.** New description. Omit to leave unchanged.                                                                                                                                                                                                 | `"Updated description."`                                                                                                    |
| **runbookUrl**                | String  | **Optional.** New runbook URL. Omit to leave unchanged.                                                                                                                                                                                                 | `"https://runbooks.example.com/anomalous-response"`                                                                         |
| **titleTemplate**             | String  | **Optional.** New violation title template. Omit to leave unchanged.                                                                                                                                                                                    | `"{{ conditionName }} on {{ entity.name }}"`                                                                                |
| **violationTimeLimitSeconds** | Int     | **Optional.** Force-closes open violations after this many seconds.                                                                                                                                                                                     | `86400`                                                                                                                     |
| **signal**                    | Map     | **Optional.** Advanced signal and streaming settings. See `createStaticNrqlCondition` for field descriptions.                                                                                                                                           | `{"aggregationWindow": 60, "aggregationMethod": "EVENT_FLOW"}`                                                              |
| **expiration**                | Map     | **Optional.** Loss-of-signal settings. See `createStaticNrqlCondition` for field descriptions.                                                                                                                                                          | `{"closeViolationsOnExpiration": true, "expirationDuration": 300}`                                                          |
| **selectors**                 | List    | **Optional.** JQ selectors to extract values from the response.                                                                                                                                                                                         | ```yaml selectors:   - name: conditionId     expression: ".data.alertsNrqlConditionBaselineUpdate.id" ```                   |

## 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 `id`, `name`, `enabled`, `policyId`, `entityGuid`, `type`, or `baselineDirection` from `data`. ```json {   "data": {     "alertsNrqlConditionBaselineUpdate": {       "id": "7654322",       "name": "Anomalous throughput",       "enabled": true,       "policyId": "2000002",       "entityGuid": "MTE5MzMzNDd8TlIxfE5SUV9DT05EQVRJT058NzY1NDMyMg",       "type": "BASELINE",       "baselineDirection": "UPPER_ONLY"     }   } } ``` |

## Example

The following example changes the deviation direction on a baseline condition to upper only.

| Workflow example                                                                                                                                                                                                                                                                                                                                                                                     |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ```yaml name: update_baseline_nrql_condition description: Update a baseline NRQL alert condition steps:   - name: updateBaselineCondition     type: action     action: newrelic.alerts.updateBaselineNrqlCondition     version: 1     inputs:       accountId: ${{ .workflowInputs.accountId }}       id: ${{ .workflowInputs.conditionId }}       baselineDirection: "UPPER_ONLY"     next: end ``` |
