# Creating workflows

You can either create workflows from scratch or install them from Nexthink Library to accelerate adoption. Customize Nexthink-library workflows using the [workflow designer](#design-workflow-logic).

To set up new workflows from scratch, follow these steps:

{% stepper %}
{% step %}

### Create a workflow

Select **Workflows** from the main menu, and click **New** at the top of the navigation panel to open the workflow designer.

{% hint style="info" %}
To access and edit the configuration of existing workflows:

* Click on the workflow hyperlink located in the table on the [Manage workflow](https://docs.nexthink.com/platform/user-guide/workflows/managing-workflows) page.
* Click the **Edit workflow** button located in the selected [workflow dashboard](https://docs.nexthink.com/platform/user-guide/workflows/monitoring-workflows-dashboard).

Then, continue to follow the steps listed below.
{% endhint %}

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-5425704c8716cba8fd8fdcbb6f030b020f40975f%2Fwf-1694520271.png?alt=media" alt="New workflow button"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Design workflow logic

From the workflow designer, build the workflow structure using the visual interface and canvas.

In the **Toolbox** tab on the right-side panel, drag and drop the building blocks onto the workflow canvas, according to the required structure and logic:

* [Add Thinklets](https://docs.nexthink.com/platform/user-guide/workflows/creating-workflows/configuring-thinklets) to execute available Nexthink actions or integrate with 3rd party systems via APIs.
* [Add Flow controls](https://docs.nexthink.com/platform/user-guide/workflows/creating-workflows/configuring-flow-controls) to drive workflow progression and decision logic based on values collected by the workflow or Nexthink data.
* [Add Connectors](https://docs.nexthink.com/platform/user-guide/workflows/creating-workflows/configuring-connector-thinklet) to use pre-configured integrations to third-party APIs.

Position elements freely on the canvas to organize them as needed. Use the **Auto-layout** button to automatically arrange components in a clean, consistent structure.

{% hint style="info" %}
Zoom in and out, and frame the entire workflow using the workflow map controls.

The window in the bottom left corner shows the overall workflow and your current position
{% endhint %}

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-6e6b6220afbf3c104be201c4c2ac15ec8e2d2875%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Link and sequence the added workflow components, in the preferred order, using your cursor:

* Hover an element on the workflow canvas to reveal its blue circle or anchor.
* Left-click and drag from the blue circle to another component to create a connection. See the image above.

<details>

<summary><strong>Adhere to workflow design principles when incorporating steps</strong></summary>

* A thinklet can have multiple entry points from other thinklets.
* A thinklet can only have one exit path to another thinklet.
* Every path of the workflow must finish with an **End block** thinklet.
* Every possible outcome of a workflow condition must have a pathway leading from it.
* Thinklets for remote actions and campaigns can handle expired scenarios—such as offline devices, no user response—without breaking workflow sequence.
* Condition flow-control thinklets support manual custom fields—`user` or `device` attributes—to drive workflow decision logic.

Refer to the [manual custom fields](https://docs.nexthink.com/platform/user-guide/administration/content-management/custom-fields-management#customfieldsmanagement-choosingmanualcustomfieldtypemanual) documentation to create and configure custom fields for workflows.

</details>

Remove existing links between components using the *Delete* key to establish a new preferred connection, while keeping the overall workflow design.

As a result, you can streamline workflows from the Nexthink Library by swiftly detaching and removing unnecessary workflow conditions.
{% endstep %}

{% step %}

### Define workflow details

From the workflow designer, fill in the **Workflow details** using the right-side panel:

* **Name**: The workflow name displays on the **Manage workflows** page and in related NQL queries ran within Nexthink.
* **NQL ID**: The system automatically generates a unique identifier from the workflow **Name**. Use the NQL ID to query this workflow within Nexthink. Once saved, you cannot edit the NQL ID.

For workflow **Triggers** and **Targets**, see the next steps below.

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2FVQlTCyGiN2y2WgoNutOF%2Fimage.png?alt=media&#x26;token=34189e6d-6995-4ba8-8c25-4780c5f8451e" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Choose workflow triggers

From the workflow designer, on the **Workflow details** tab in the right-side panel, select the **Trigger** mechanisms to define when and how the automation starts running.&#x20;

Refer to the [triggering-workflows](https://docs.nexthink.com/platform/user-guide/workflows/triggering-workflows "mention") documentation to configure the workflow trigger most suited for your use case.

{% hint style="info" %}
If you configure workflow **Parameters**, you can add input values to the selected workflow **Triggers**.
{% endhint %}

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2F5CLWiEbPiDJJSuOY9uyx%2Fimage.png?alt=media&#x26;token=8529c37d-cd25-4ecc-a31f-4a7b9121f019" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Optionally make the workflow available in Nexthink Spark

Aside from workflow triggers, you can enable Nexthink **Spark** to run the workflow when handling support issues or requests in real time. That is, if Spark determines the workflow can resolve the issue at hand.&#x20;

From the **Workflow details** tab, tick the box to make the workflow **Available in Spark.** This lists the workflow as a Spark action under the Spark **Manage actions** page.&#x20;

You should also grant Spark permission to run the designated workflow. Refer to [#enabling-spark-permissions](https://docs.nexthink.com/platform/spark/setting-up-and-managing-spark/managing-agent-actions#enabling-spark-permissions "mention") for more details.

{% hint style="info" %}
Depending on your current licensing model, this capability may require an additional license. Contact your Nexthink representative for more information.

Refer to the [#spark](https://docs.nexthink.com/platform/overview/products#spark "mention") documentation for more information.&#x20;
{% endhint %}

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2F4iKzG9wlqIHGbpNbsss6%2Fimage.png?alt=media&#x26;token=415f8c89-518a-40f3-ae54-8a5bdd97edda" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Define workflow targets

From the workflow designer, on the **Workflow details** tab in the right-side panel, define workflow **Targets**:

<details>

<summary><strong>Devices</strong></summary>

Enable the workflow as an available action when listing **Devices**, including **Device View** and **Amplify**.

</details>

<details>

<summary><strong>Users</strong></summary>

Enable the workflow as an action when listing **Users** in **Investigations**.

</details>

<details>

<summary><strong>Sessions</strong></summary>

Enable the workflow to be triggered on **VDI sessions**—refer to [Using session view](https://docs.nexthink.com/platform/vdi-experience/using-session-view#running-remote-actions-and-workflows) documentation for more information. When targeting a VDI session, choose from:

* **Client**: Targets the physical client devices used to initiate the session. Client devices can only be targeted if they are managed by Nexthink.
* **VDI**: Targets VMs in the virtual infrastructure. When selecting VDI, the user is choosing a VM in the VDI session to which the client devices connect.
* **Allow User Override Selection**: allows users to manually change the target when executing a workflow on the VDI session dashboard.

{% hint style="warning" %}
Targeting **Sessions** in workflows requires [Nexthink VDI experience](https://docs.nexthink.com/platform/user-guide/vdi-experience).
{% endhint %}

</details>

{% hint style="warning" %}
Workflows require both `user` and `device` context to start execution. Refer to the [#how-do-workflows-identify-the-user-and-device-when-triggered](https://docs.nexthink.com/platform/user-guide/triggering-workflows#how-do-workflows-identify-the-user-and-device-when-triggered "mention") documentation to learn how the systems identifies user-device pairs.
{% endhint %}

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-e9aa7ab8cc989f957847e223a43876bee40711e5%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add workflow parameters

**Workflow parameters** are optional inputs you can define when creating a workflow. These parameters allow you to:

* Set values at the start of the workflow that remain constant during execution.
* Adapt a single workflow design to different scenarios or use cases.

For example, you may use workflow parameters to change target groups, thresholds, or integration settings without modifying the workflow itself.

Refer to the [Parameters and dynamic values](https://docs.nexthink.com/platform/user-guide/workflows/parameters-and-dynamic-values#workflow-parameters) documentation to learn how to use workflow parameters.

{% hint style="info" %}
Once defined, you can assign values to workflow parameters when configuring the workflow **Triggers**, under the **Workflow details**.
{% endhint %}

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-ff177cfc62e6bc2ad40370a03bd644a7d0250116%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Optionally modify the workflow in NEAL

For advanced scenarios, you can use the **NEAL** tab (Nexthink Experience Automation Language) in the right-side panel, as the scripting language and underlying code behind the workflow.

This code is automatically generated as you design and construct the workflow logic visually. The workflow visual designer and the NEAL script stay synced, meaning you can safely switch between views.

Refer to the [neal](https://docs.nexthink.com/platform/user-guide/workflows/creating-workflows/neal "mention") documentation to learn how to read and script workflows in NEAL.

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-7a769f23fe9b46034b7c4299ca5d5f9b0f010430%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Validate and save the workflow

At the bottom of the workflow design page, the system warns you when the designed workflow is malfunctioning, assisting you in troubleshooting and configuring it for proper functionality.

Open the **Errors** side panel to trigger validation and review any issues identified. Invalid steps are highlighted in red on the workflow canvas for easy correction.

Remember to **Save** your workflow regularly, even if it's incomplete or contains errors (invalid). When saving workflows, keep in mind:

* When you modify and save an active/valid workflow, ongoing executions are automatically cancele&#x64;**.** A warning message appears, asking for confirmation before applying changes.
* When you update the workflow's triggering or scheduling settings without modifying its design, it does not affect ongoing executions.

{% hint style="warning" %}
Resolving existing validation issues may uncover further problems, as some issues could be obstructing the validation of other design elements.

Validation messages are not available in the [NEAL](https://docs.nexthink.com/platform/user-guide/workflows/creating-workflows/neal) tab.
{% endhint %}

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-58a8e5b94a2e60d896d7f10cca850f79f8b9602b%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

***

## Workflow design use cases

Leverage the workflow visual designer to adapt your smart automations to specific use cases, such as handling expiration scenarios or building user-adaptive pause behaviors.

<details>

<summary>Handling expirations in workflows</summary>

Some workflow thinklets—like **Remote Actions** and **Campaigns**—depend on a user or device being available to complete their task. If unavailable, the workflow expires.

To manage these expiration scenarios, the Remote Actions and Campaigns thinklets have a **Timeout** property that sets how long the workflow should wait before triggering the thinklet's **Expired** path—see the image below.

When the **Expired** path is triggered, the workflow can take a fallback action, such as:

* Creating a ServiceNow ticket
* Sending an email
* Retrying a different path

If you do not connect the thinklet's **Expired** output, the workflow stops when that timeout is reached. Use a longer **Timeout** if the device is often offline or users need more time to respond.

{% hint style="info" %}
Refer to the [campaign-thinklet](https://docs.nexthink.com/platform/user-guide/workflows/creating-workflows/configuring-thinklets/campaign-thinklet "mention") and [remote-action-thinklet](https://docs.nexthink.com/platform/user-guide/workflows/creating-workflows/configuring-thinklets/remote-action-thinklet "mention") documentation to learn how to set up these types of workflow thinklets.
{% endhint %}

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-84abcef1a7737db30fa532fa36b2acb4f41550e9%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary>Building adaptive wait behavior in workflows</summary>

To further flexibilize workflows, you may configure **Wait** thinklets to use **Dynamic time delays** based on user inputs, workflow parameters, or context—such as the user's time zone.

Dynamic time delays allow workflows to pause intelligently based on employee choices or responses to timing, ensuring notifications or restarts happen at the right moment for each user.

**Use case example:** You need to reboot a user's device, but want to let them decide when (timing).

1. Add a **Message** thinklet asking: *When can we restart your device?*
   * Provide options such as *Now*, *In 1 hour*, *In 2 hours*, or *By end of day.* See the image below.

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-c449e5654e4577b3e161a212146e082646b8b84b%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Add a **Condition** flow control to check the user's response.
   * If the response is *By end of day*, use a **Function** thinklet to calculate the end of the current business day based on the user's time zone, then trigger the reboot.
   * Otherwise, use a **Wait** thinklet with a **Dynamic time delay** based on the selected option. In this case, the number of **Hours** provided by the user to the preceding **Message** thinklet.

{% hint style="info" %}
Refer to the [Configure flow controls](https://docs.nexthink.com/platform/user-guide/workflows/configuring-flow-controls#designer-delay-1) documentation to learn how to configure **Wait** thinklets in detail.
{% endhint %}

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2Fgit-blob-193bbaa89b990a48f89cd12c8103d6dbd96c7e27%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary>Updating custom fields in workflows for downstream use</summary>

Use the **Update custom fields** thinklet to write values to **Device** or **User** custom fields. This enables you to record workflow outcomes and pass structured data to dashboards, investigations, or other workflows.

The table below lists common use cases for **Update custom fields** thinklets:

| Device refresh scheduling                         | After scheduling a hardware replacement, update a device field (for example, `Scheduled for refresh = Yes`) so L1 teams can deprioritize non-urgent issues. |
| ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Compliance enforcement                            | Mark a device as `Compliant = Yes` at the end of a successful remediation flow. This helps IT track compliance progress and surface results in dashboards.  |
| Store employees' preferred communication channel. | Set a user field such as `Employee communication channel` based on campaign answers. This can trigger follow-up workflows or training reminders.            |

{% hint style="info" %}
Refer to the [update-custom-fields-thinklet](https://docs.nexthink.com/platform/user-guide/workflows/creating-workflows/configuring-thinklets/update-custom-fields-thinklet "mention") to learn how to set up this type of workflow thinklet.
{% endhint %}

</details>

***

RELATED TOPICS

* [Getting started with Workflows](https://docs.nexthink.com/platform/user-guide/workflows/getting-started-with-workflows)
* [Managing Workflows](https://docs.nexthink.com/platform/user-guide/workflows/managing-workflows)
* [monitoring-workflows-dashboard](https://docs.nexthink.com/platform/user-guide/workflows/monitoring-workflows-dashboard "mention")


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nexthink.com/platform/user-guide/workflows/creating-workflows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
