> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/action-center/servicenow/create-task.md).

# Create Task

Orders a ServiceNow service catalog item for each device the workflow collected. For every device it looks up the matching configuration item (CI) in the `cmdb_server` table and places one catalog order for that CI.

### Before you begin

* A ServiceNow instance, a user with Basic authentication that can read `cmdb_server` and order the catalog item, and the `sys_id` of the catalog item.
* Accepted asset type: `device`. No required columns, but the lookup column must be selected in **Edit Columns**: `Specifics.microfocus-ucmdb.ucmdbId` (default) when **CI Lookup Field** is uCMDB ID, or `Hostname` when it is Hostname. Otherwise the job fails with a message that names the missing column.
* Defaults you saved for this job in [Action Center Settings](broken://pages/55de6aa0ebf5edfd09326013f2b89d610d5e4839) pre-fill the node form. Options you leave out are filled from them when you save the node.

### Settings

These are the fields of the job node form.

| Setting         | Type    | Required | Default                              | Description                                                                                                                                           |
| --------------- | ------- | -------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Domain          | Text    | Yes      | None                                 | ServiceNow instance domain, for example `instance.service-now.com`. `https://` is added when missing.                                                 |
| Username        | Text    | Yes      | None                                 | ServiceNow username for Basic authentication.                                                                                                         |
| Password        | Text    | Yes      | None                                 | ServiceNow password for Basic authentication. Secret. Masked after saving.                                                                            |
| Catalog Item ID | Text    | Yes      | None                                 | `sys_id` of the service catalog item (`sysparm_id`).                                                                                                  |
| Quantity        | Text    | No       | `1`                                  | Quantity for the catalog order.                                                                                                                       |
| Variables       | JSON    | No       | `{}`                                 | JSON object of variables for the catalog item. `Hostname` and `IP` are filled in per device by the job.                                               |
| Timeout         | Integer | No       | 30                                   | Timeout for ServiceNow API requests, in seconds.                                                                                                      |
| Thread Count    | Integer | No       | 8                                    | How many devices are processed in parallel. Lower it if ServiceNow starts rate limiting the instance.                                                 |
| CI Lookup Field | Choice  | No       | `ucmdb_id`                           | Which `cmdb_server` column identifies the device. Choices: `ucmdb_id` (uCMDB ID, matches `correlation_id`) and `hostname` (Hostname, matches `name`). |
| uCMDB ID Column | Text    | No       | `Specifics.microfocus-ucmdb.ucmdbId` | Device column that holds the uCMDB ID. It must also be selected in **Edit Columns**. Used only when CI Lookup Field is uCMDB ID.                      |

### How it works

* For each device the job takes the lookup value from the lookup column and queries `<Domain>/api/now/table/cmdb_server` for a CI with that value (`install_status` 1, first match only).
* It then orders the catalog item with `POST <Domain>/api/sn_sc/servicecatalog/items/<Catalog Item ID>/order_now`. The order carries your **Variables** plus `Hostname` set to the CI `sys_id` and `IP` set to the device IP addresses, comma separated.
* A device is skipped (and counted) when it has no lookup value, when its value contains `^`, `,`, `&` or `=`, when no CI matches, or when its CI was already ordered for another device in the same run.
* A failed request for one device is logged and counted as failed. The job fails only when there were devices and no order was created. Otherwise it logs a summary such as `ServiceNow: 3 request(s) created for 4 device(s) - skipped 1 without a matching CI.`
* Devices are processed in parallel, up to **Thread Count** at a time.
* The assets pass on to the next node unchanged.

### Example

Order a catalog item for each matched server, looking CIs up by hostname.

| Setting         | Value                      |
| --------------- | -------------------------- |
| Domain          | `instance.service-now.com` |
| Username        | `your-user`                |
| Password        | `YOUR_API_TOKEN`           |
| Catalog Item ID | `YOUR_CATALOG_ITEM_SYS_ID` |
| CI Lookup Field | `hostname`                 |
| Variables       | `{}`                       |

### What's next?

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>About Action Center</strong></td><td>Workflows, triggers, conditions and job nodes.</td><td><a href="broken://pages/fdaf89bda8bc4742e87df5d29154e1ff5ff26362">Broken link</a></td></tr><tr><td><strong>Action Center Settings</strong></td><td>Save default values for this job.</td><td><a href="broken://pages/55de6aa0ebf5edfd09326013f2b89d610d5e4839">Broken link</a></td></tr><tr><td><strong>Manage Engine Service Desk</strong></td><td>Create a ManageEngine Service Desk request.</td><td><a href="broken://pages/be0f077853d56c37081a39b10c8567d519bbbfaf">Broken link</a></td></tr><tr><td><strong>Create Xurrent Request (formerly 4Me)</strong></td><td>Create a Xurrent request.</td><td><a href="broken://pages/ae6d5ebc595053dc4189f0bb86e3db312823e474">Broken link</a></td></tr></tbody></table>

{% hint style="info" %}
Available starting from version 6.6.2.
{% endhint %}
