> For the complete documentation index, see [llms.txt](https://developer.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.collibra.com/tutorials/soft-delete-workflow.md).

# Soft delete workflow

In this tutorial you create a workflow that helps you change the status of an asset to **Missing from source** instead of permanently deleting it.

<img src="/files/p0zByPv2AQeLitn8jW4S" alt="" width="175">

## Prerequisites

* Access to the Workflow Designer for designing the workflow.
* Access to a Collibra environment as a user with the Sysadmin global role or a global role that has at least the Workflow Administration global permission for configuring the workflow.
* Optionally, access to the Collibra Console for troubleshooting.

{% hint style="success" %}
For details about the Workflow Designer, see the [Workflow Designer documentation](/workflows/workflows-at-collibra.md).
{% endhint %}

## Create a new app for your workflow

Access the Workflow Designer and create a new app:

{% stepper %}
{% step %}
In the navigation bar, select **Apps**.
{% endstep %}

{% step %}
In the top left corner of the **Apps** tab, click **✚ Create app**.
{% endstep %}

{% step %}
Enter the required information:

* **App name**: *Soft delete asset workflow*
* **App key**: The app key is automatically generated based on the App name value.
* **Description**: Although optional, the descriptions allow you to see an overview of the workflow purpose, for example *This workflow allows you to soft delete assets by changing the status of the selected asset to "Missing from resource" instead of completely removing the asset from Collibra.*
  {% endstep %}

{% step %}
Click **Create new app**.
{% endstep %}
{% endstepper %}

<i class="fa-chevrons-right">:chevrons-right:</i> Your newly created app appears in the **App models list** on the **Apps** tab and you are redirected to the app editor page.

## Create a new process for your app

{% stepper %}
{% step %}
In the app editor page, click **✚ Add model**.
{% endstep %}

{% step %}
In the **What would you like to do?** dialog box, select **Create a new model for the app** → **Process**.
{% endstep %}

{% step %}
Enter the required information:

* **Model name**: *Delete asset*
* **Model key**: The model key is automatically generated based on the Model name value.
* **Description**: Although optional, the descriptions allow you to provide an overview of the workflow purpose.
  {% endstep %}

{% step %}
Click **Create new model**.
{% endstep %}
{% endstepper %}

<i class="fa-chevrons-right">:chevrons-right:</i> Your newly created process appears in the app editor and you are redirected to the process editor page.

## Edit the process of your workflow

{% stepper %}
{% step %}
In the app editor, select your process.\ <i class="fa-chevrons-right">:chevrons-right:</i> The process editor opens.

{% hint style="info" %}
Your process already contains a start event.
{% endhint %}
{% endstep %}

{% step %}
From the **Shape repository**, drag a **Script task** to the canvas and place it to the right of the start event.

<img src="/files/2PH5ARjsHHo65JzWQC2D" alt="" width="375">
{% endstep %}

{% step %}
From the **Shape repository**, drag an **End event** to the canvas and place it to the right of the script task.

<img src="/files/MaZlh6f1EBOTyCHUipRk" alt="" width="375">
{% endstep %}

{% step %}
Click the start event and then drag and drop a **Sequence flow** over the script task.
{% endstep %}

{% step %}
Click the script tasks and then drag and drop a **Sequence flow** over the end event.

<img src="/files/9R9JqqiqdONs7TdNINBf" alt="" width="223">
{% endstep %}
{% endstepper %}

### Add a form property to your start event

You use a form property in the start event to define the [process variable](/workflows/creating-workflows/workflow-basic-configuration-elements/process-variables.md) that contains the ID of the new status of the asset. You can access it later in the process by referencing the ID you have set. Once you publish the workflow in Collibra, you can also update the value from the **Variables** section in the workflow [definition settings page](/workflows/managing-workflows-in-collibra/view-and-edit-workflow-definition-settings.md).

{% stepper %}
{% step %}
On the canvas, select the start event.
{% endstep %}

{% step %}
In the attribute bar, click **Form Properties**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The **Form properties** dialog box appears.
{% endstep %}

{% step %}
Click **+ Add item**
{% endstep %}

{% step %}
Enter the required information:

* **Id**: *statusId*
* **Name**: *The status ID of the deleted asset.*
* **Responsibilities**: *String*
* **Default**: *00000000-0000-0000-0000-000000005066*
* **Required**: Yes
* **Readable**: No
* **Writable**: Yes
  {% endstep %}

{% step %}
Click **OK** to save the form property.
{% endstep %}
{% endstepper %}

### Create a script for your script task

The script changes the status of the selected asset to the one defined by the **statusId** variable.

{% stepper %}
{% step %}
On the canvas, select the script task.
{% endstep %}

{% step %}
In the attribute bar, click **Script**.
{% endstep %}

{% step %}
Add the following script:

```groovy
import com.collibra.dgc.core.api.dto.instance.asset.ChangeAssetRequest

assetApi.changeAsset(ChangeAssetRequest.builder()
	.id(item.id)
	.statusId(string2Uuid(statusId))
	.build()
);
```

{% endstep %}

{% step %}
Click **OK** to save the script.
{% endstep %}
{% endstepper %}

{% hint style="success" %}
Save your work.
{% endhint %}

{% hint style="success" %}
For more information about scripts, see the [Introduction to Builders](/tutorials/introduction-to-builders.md) tutorial.
{% endhint %}

## Publish your workflow

You publish a workflow directly from the Workflow Designer to your Collibra environment:

{% stepper %}
{% step %}
In Workflow Designer, open a workspace.
{% endstep %}

{% step %}
For the app you want to publish, select <img src="/files/kXj7xFvJ8VGrjFIIqsaa" alt="More icon" data-size="line"> more → Publish
{% endstep %}

{% step %}
Click **Publish App** to confirm and upload the workflow to the target environment.
{% endstep %}
{% endstepper %}

{% hint style="success" %}
The target environment is the Collibra environment you used to access the Workflow Designer.
{% endhint %}

{% hint style="danger" %}
Uploading a workflow with the same process ID as an existing workflow in Collibra replaces the existing workflow.
{% endhint %}

{% hint style="info" %}
Collibra does not accept two workflows with the same display name.
{% endhint %}

## Configure the workflow settings

To fine tune the workflow you must change the default configuration in Collibra:

{% stepper %}
{% step %}
On the main toolbar, click <img src="/files/3V7eGcHFj9e331H6ZCVh" alt="Products icon" data-size="line"> → <img src="/files/TtcnVN7Se4qJshpuw3lq" alt="Cogwheel icon" data-size="line"> **Settings**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The **Settings** page opens.
{% endstep %}

{% step %}
Click **Workflows**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Workflows settings page appears on the **Definitions** tab page.
{% endstep %}

{% step %}
Select the **Delete asset** workflow.
{% endstep %}

{% step %}
On the workflow definition page, in the **Applies To** section, click **Edit**.
{% endstep %}

{% step %}
From the drop-down list, select **Asset**.
{% endstep %}

{% step %}
Click **Save**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The **Applies To** dialog box appears.
{% endstep %}

{% step %}
Click **Save**.
{% endstep %}

{% step %}
At the right of the title bar, click <img src="/files/LcGMz6kN82smTkxGKuui" alt="" data-size="line"> to enable the workflow.
{% endstep %}
{% endstepper %}

## Additional resources

* Downloads:
  * [Soft delete asset workflow-bar.zip](https://cdn.collibra.com/developer/Soft%20delete%20asset%20workflow-bar.zip) to publish in Collibra or edit in the Workflow Designer.
  * [DeleteAsset.bpmn](https://cdn.collibra.com/developer/DeleteAsset.bpmn) to edit using the Eclipse plug-in.
* Read the [Workflow Designer documentation](/workflows/workflows-at-collibra.md).
* Read the [Introduction to builders](/tutorials/introduction-to-builders.md) tutorial.
