---
title: Update an alert policy
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/newrelic/alerts/newrelic-alerts-update-policy
---

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

Updates an existing alert policy. You can change the policy name, incident preference, or both. Omitting a field leaves it unchanged.

## 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 policy.                                                                            | `123456`                                                                                |
| **id**                 | String | **Required.** The ID of the policy to update.                                                                                        | `"2000002"`                                                                             |
| **name**               | String | **Optional.** New name for the policy. Omit to leave unchanged.                                                                      | `"Production Services - Updated"`                                                       |
| **incidentPreference** | String | **Optional.** New incident preference. Omit to leave unchanged. One of `PER_CONDITION`, `PER_CONDITION_AND_TARGET`, or `PER_POLICY`. | `"PER_POLICY"`                                                                          |
| **selectors**          | List   | **Optional.** JQ selectors to extract values from the response.                                                                      | ```yaml selectors:   - name: policyId     expression: ".data.alertsPolicyUpdate.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`, `incidentPreference`, `accountId`, or `entityGuid` from `data`. ```json {   "data": {     "alertsPolicyUpdate": {       "id": "2000002",       "name": "Production Services - Updated",       "incidentPreference": "PER_POLICY",       "accountId": 123456,       "entityGuid": "MTIzNDU2fEFJT1BTfE9QVFxfUE9MSUNZfDc4OTA="     }   } } ``` |

## Example

The following example renames an alert policy.

| Workflow example                                                                                                                                                                                                                                                                                                                                   |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ```yaml name: update_alert_policy description: Rename an alert policy steps:   - name: updatePolicy     type: action     action: newrelic.alerts.updatePolicy     version: 1     inputs:       accountId: ${{ .workflowInputs.accountId }}       id: ${{ .workflowInputs.policyId }}       name: "Production Services - Updated"     next: end ``` |
