# Step 3: Create Process flow

### The flow of our process as per our requirements

<figure><img src="https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FX6ZttbPWUstLGr3GVLDL%2FWorkflow%20to%20be%20digitized.png?alt=media&#x26;token=7ccf3bd9-9bed-46c4-ae3f-6cea1384e10f" alt=""><figcaption></figcaption></figure>

### Step-by-step guide for implementing the above flow

Using the[ <mark style="color:purple;">**workflow builder tool**</mark>](https://docs.senpiper.com/workflow-builder/introduction) we’ll be able to **mimic the hierarchy** followed in the organization regarding the **business processes**.

#### 1. Initiate a workflow

Go to workflow builder and click "**Add a new workflow**" S**elect the group** and **the form** for which you want to **create the workflow**. Name your workflow "YourName\_ Reimbursement Workflow"

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FL83fvmE0v7zOE6dFuoMc%2Fimage_2022-01-18_165733.png?alt=media\&token=41e577db-e1d1-4f8c-9cbf-1fe45140956e)

Once you’ve filled in the requisite details, it’ll show you the interface for the workflow builder.

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FPfrMQ26iuX4iiJLBjDia%2Fimage_2022-01-18_165806.png?alt=media\&token=1b92d9f9-e6b0-443d-b537-09f4235cef57)

Now proceed by clicking the settings button beside the submit button to add a comment. “**The reimbursement form has been submitted**.” Learn more about the <mark style="color:purple;">**comments in workflow.**</mark>

{% hint style="info" %}
Comments are mandatory in every button of the workflow you create. It acts as a changelog when any workflow action button is clicked.
{% endhint %}

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FBNn4J8H86OqFsN7EOQGw%2Fimage_2022-01-18_165847.png?alt=media\&token=97522845-a2fb-4dd5-90ca-db83ae5dd99d)

#### 2. **Apply a condition**&#x20;

> Use case: As we discussed, if the reimbursement amount is **more than 10,000** it’ll be assigned to the **Department Head,** and amounts less than that will be handled by the **Manager**.

* Click the green plus icon and select the yes option for ‘**Do you want to apply any condition**’. Learn more on <mark style="color:purple;">**how to apply a condition at a step**</mark>

<figure><img src="https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FqRdRH3Y5AF2esplEphtX%2Fworkflow%20condition%20button.png?alt=media&#x26;token=5e2425b1-22cb-48f0-b43e-36a315ee79cb" alt=""><figcaption></figcaption></figure>

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FPFg7FcuYfGmMlNrOoMsx%2Fworkflow%20confition%20pane%20for%2010000.png?alt=media\&token=6cce7890-4a64-48dc-bd92-69366d2cfbb8)

* Now to set another condition go back to the ‘**+**’ icon in front of submit button and add the rule "Total Amount" <= 10,000

<figure><img src="https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FvUcq9hkqUhPZkKOKgiO1%2Fworkflow%20apply%20another%20condition.png?alt=media&#x26;token=45439a79-b4c4-42b2-85ef-822def44095b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FQzwSdYveWqDIBmTWiP9P%2Fworkflow%20condition%20pane%20less%2010000.png?alt=media&#x26;token=a855dd8c-616b-4928-ad9c-186ce1557409" alt=""><figcaption></figcaption></figure>

* The above two conditions **create 2 separate paths** for the workflow based on the "**total amount**" of the reimbursement, the workflow would now look like this.

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FsqL92qxdSFF2fqqwgVuB%2Fimage_2022-01-18_170013.png?alt=media\&token=3ac52025-6505-4a58-a37a-32f4730841b5)

Now that we have created the 2 paths for different conditions of the workflow. we will proceed with each path

#### 3. Create action buttons in the workflow

* Click on "+" button below the condition box where "Total amount > 10000" to ‘**add a step**’. Each workflow step has the following properties
  * Target status
  * Action buttons
  * Other Actions

<figure><img src="https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FIFg4eB2jMEHxKGpomdsX%2FWorkflow%20step.png?alt=media&#x26;token=1d3b9f80-694d-4048-a342-17b1b7a54e83" alt=""><figcaption></figcaption></figure>

* Select the target status for each node as "**submitted**". Learn more about the <mark style="color:purple;">**target status in a workflow step**</mark>
* Click on "**Define future actions**" and add a new action button "**Approve**".  Learn more about the <mark style="color:purple;">**actions buttons**</mark>

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2Fcuaw5xDJIRTBns66PQB1%2Fimage_2022-01-18_170122.png?alt=media\&token=40a6b7ea-d3fb-4982-a468-e9b715e8b5cb)

* And while we do that, we’ll assign the button to the **Department Head**, by selecting **company defined roles** and then **Department Head**.

{% hint style="info" %}
Ensure that the "**department head"** role should be present in the system beforehand and allocated to the right users. Learn more about <mark style="color:purple;">**custom roles**</mark>
{% endhint %}

* Under the section "**form edit settings**". Click on "**manage individual fields**". &#x20;

<figure><img src="https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2F6IgwGKuPeYJQw1dmSZc3%2Fworkflow%20manage%20invividual%20fields.png?alt=media&#x26;token=bdcd0f13-a830-4094-844b-f620a900b218" alt=""><figcaption></figcaption></figure>

* Click on manage fields and select the "**Approval remarks**" fields. Set the following properties
  * Visibility settings: **Show to user**
  * Edit settings: **make editable**
  * Optionality settings: **Make field mandatory**

> Learn more about <mark style="color:purple;">**managing fields at a workflow step**</mark>

<figure><img src="https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2Fn42G5KdCYErJKcE0BfsO%2FWorkflow%20field%20settings.png?alt=media&#x26;token=6d4bc359-e93d-487e-821f-8cc7fe0a5fc5" alt=""><figcaption><p>Fields state management at a workflow step</p></figcaption></figure>

* Provide comments on this button under the section "**Comment log settings**".&#x20;
* Click on "**add a new button"** and add a "**Reject**" button with the same settings.

#### Adding steps for the "manager" role

* Now click on the other conditional node with "**total amount**" <= 10000 and repeat the above steps to add the "**Approve**" and "**Reject**" buttons.
* While creating the buttons on these nodes" choose the company-defined roles as "**Manager**"

{% hint style="info" %}
Ensure that the **Manager** role should be present in the system beforehand and allocated to the right users. Learn more about <mark style="color:purple;">**custom roles**</mark>
{% endhint %}

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FwOHqgrHyWL4G0lnPLrpZ%2Fworkflow%20both%20conditions%20applied.png?alt=media\&token=f4ff4b5f-3397-44d7-ab3d-a1057d60394d)

* Once the workflow action buttons are created for both conditions, click on the "+" icon of each button and select "**no**" to apply any condition.

> We selected no as we don't require further conditional logic in the stated requirements&#x20;

<figure><img src="https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2Fb3wDhfeISI5zbvStA0VC%2Fworkflow%20action%20button%20settings.png?alt=media&#x26;token=766ded6a-6ef2-466f-9bbe-f93eeafda41a" alt=""><figcaption><p>Individual action button conditions</p></figcaption></figure>

* Once you click on continue a new step is created. Set the target status for the step accordingly. Following should be the statuses

| Button clicked | Workflow should move to following status |
| -------------- | ---------------------------------------- |
| Approve        | Approved                                 |
| Reject         | Rejected                                 |

<figure><img src="https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FVT61Nz7DofJchOf13bG1%2Fworkflow%20action%20button%20target%20status.png?alt=media&#x26;token=1ae96628-1bf0-4ae9-a9b5-cfeceb2da153" alt=""><figcaption></figcaption></figure>

* Repeat this process for other sets of buttons&#x20;

#### 4. End the workflow

* Now we are at the end of the requirement of process flow requirements, let's close the workflow.
* Click on the define future actions and click on "**End workflow**"

<figure><img src="https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FmPVPM01Xq4TerJqgIqnl%2Fend%20workflow%20pane.png?alt=media&#x26;token=1b208f72-ef1e-4499-ac07-568ae7670f4f" alt=""><figcaption><p>End a workflow</p></figcaption></figure>

<figure><img src="https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FCjB2LTp852XTamn3VzmA%2Fworkflow%20ended.png?alt=media&#x26;token=94cc91a5-1d6d-4fa1-a4f8-83dd99fa58a4" alt=""><figcaption><p>Workflow ended</p></figcaption></figure>

* Here’s how the finished workflow would look like

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2Fre9NrT5hfjNS1lK30563%2Fimage_2022-01-18_170230.png?alt=media\&token=686aa12c-aeab-45e3-a5e6-8d354ccacddd)

To wrap everything up, click apply changes and the workflow configuration is completed.

### Testing the workflow

* Go to the created group
* Add a new submission to the reimbursement form with an amount less than 10000
* Assign the roles of "**manager**" and "**department head**" to two different users. Learn how to [<mark style="color:purple;">**add roles to users**</mark>](https://docs.senpiper.com/user-management/roles-and-users-for-the-reimbursement-use-case)<mark style="color:purple;">**.**</mark>&#x20;
* Add those users to the group. Learn how to [<mark style="color:purple;">**add users to a group**</mark>](https://docs.senpiper.com/user-management/managing-users/how-to-add-users-to-a-user-list)
* Login with the credentials of the that user
* Once a submission is made the user to whom the manager role is assigned will see two buttons "Approve" and "Reject"
* Click on any button and finish the workflow
* Check the status of the form
