# ServiceNow Approval extension

> Hold Cloud Management Platform (CMP) orders for approval in ServiceNow, so an order is provisioned only once a ServiceNow approver has signed it off

---

Site [llms.txt](/llms.txt)

---

The extension adds a **ServiceNow Approval** admin page to CMP, where you store the connection to your ServiceNow instance and map orders to the ServiceNow workflows that approve them. Orders are sent to ServiceNow as they are submitted, and a recurring job returns the decisions.

## Before you start

- Import the **ServiceNow Approval** extension from the Content Library and restart the Apache HTTP Server. See [UI extensions](/docs/cmp/developer-resources/ui-extensions/) for the import steps.
- Create the approval workflow in ServiceNow. It must exist before you can add a workflow configuration.

## How an approval flows

1. A user places an order in CMP.
1. CMP raises a matching request in ServiceNow.
1. An approver acts on the request in ServiceNow.
1. The next run of the recurring job reads the decision and applies it to the CMP order.
1. When the order finishes, CMP closes the ServiceNow request.

The job runs every 30 minutes. To pick up a decision without waiting, run **ServiceNow Change Order Status** from **Admin** > **Recurring Jobs**.

Blueprint orders and server modification orders go to ServiceNow. An order of any other kind is approved in CMP without a request being raised. If CMP cannot raise the request, the order is canceled.

## Create the workflow in ServiceNow

Build the workflow in ServiceNow's workflow editor by following [ServiceNow's documentation](https://www.servicenow.com/docs/r/servicenow-platform/legacy-workflow/workflow-editor.html), or start from the sample provided by the extension. Its conditions are set in ServiceNow, not in CMP. CMP needs only the workflow's **name** and the **table** its requests are saved to.

To use the sample, select **Download Sample WorkFlow** on the **ServiceNow Approval** page, then in ServiceNow import the file at **Service Level Management** > **Administration** > **Workflow Editor** > **Import XML**.

## Connect CMP to ServiceNow

1. Go to **Admin** > **ServiceNow Approval**.
1. Select **Add ServiceNow Connection**.
1. Enter a **Name**, the **IP/Hostname** of the instance, and the **Protocol**, then the **Service Account** and **Password** CMP authenticates with.
1. To have CMP retry a failed call, set both **Retry Interval** and **Retry Timeout**.
1. Select **Create**. The connection appears under **ServiceNow Connections**.

## Add a workflow configuration

A workflow configuration determines which ServiceNow workflow approves which CMP orders and how CMP interprets the answer.

<div class="alert alert-warning" role="alert">


CMP reads approval decisions only from the ServiceNow Service Request table, `sc_request`. Use that table, and set **Approval Field Name** to `approval` or `stage`. With any other table or field, orders stay pending because CMP never sees the decision.
</div>


1. On the **ServiceNow Approval** page, select **Add Workflow Configuration**.
1. In the **Add ServiceNow Workflow** dialog, select the **ServiceNow Connector** and a **Request Type**.
1. Select the **Workflow Name** and the **Blueprints**, then select `sc_request` as the **ServiceNow Table**.
1. Set the **Approval Field Name**, then the **Approval Field Value** and **Rejection Field Value** CMP reads to decide whether the order was approved or rejected, for example, the field `approval` holding `Approved`.
1. Select **Save changes**. The configuration appears under **ServiceNow Workflow Configurations**.

A saved configuration cannot be edited. To change one, delete it and add it again.

Each configuration carries two buttons:

- **Make Default** applies this configuration to any order not covered by another configuration. With no default set, an order that matches nothing does not raise a ServiceNow request.
- **Payload** determines which CMP values are sent to ServiceNow with the request.

## Payload variables

Select **Payload** on a configuration to open **Modify data sent with request**, a table of ServiceNow field names and the values CMP sends for them. It opens with nine common field names and no values; add and remove rows as needed, or select **Reset to defaults** to restore the supplied list.

CMP always sends `requested_by`, `requested_for`, `description`, and `price` with every request.

A value can be a variable, which CMP replaces with the matching value from the order.

| Variable | What CMP sends |
| --- | --- |
| `{group.name}` | The name of the group the order was placed in. |
| `{order.name}` | The name of the order awaiting approval. |
| `{server.hostname}` | The hostname of a server the order will build. `{server.os_build}` and `{server.environment}` are also available. |
| `{resource.name}` | The name of the item ordered from the blueprint. Also available: `description`, which is a summary of the order, `blueprint`, `group`, and `misc_rate`. |

Any single field on the order or the group can be used the same way, such as `{order.id}`. A variable reaches one level only, so `{order.blueprint.name}` does not resolve.

## Related

- [ServiceNow](/docs/cmp/configure/integrations/it-service-management/servicenow/): The built-in ServiceNow integration.
- [UI extensions](/docs/cmp/developer-resources/ui-extensions/): Importing an extension from the Content Library.
