# Approval workflows

Plan provides the best solutions for collaborative planning and reporting within Microsoft Fabric. There are two main workflows that allow for seamless value adjustments and approvals across multiple users working on the same planning sheet.

1. [Approval workflow](/planning/approval-workflows.md)
2. [Adjustment workflow](/planning/collaborative-adjustment-workflows.md)

When multiple people update the same report, approvals are required to ensure data integrity. The approval workflow feature in Plan allows you to create a workflow when values in the report are changed.

When a data input or forecast value is updated, you can perform actions such as sending a notification email to a user or updating the status or any values in the relevant fields. When a report user updates a value, an approval/notification email is sent to their manager, and the manager can approve or reject the update by selecting the appropriate status from the manager approval dropdown. 

You can create custom approval workflows by either [creating scripts](#id-1.-using-scripts) or using the intuitive [user interface](#id-2.-no-code-approval-workflows) that doesn't require scripting.

### 1. Using scripts

In Plan, both data input and forecast columns have a scriptable **On Change Formula** section where you can specify the actions that will be triggered when any of their values change.

Let's consider the 'Exchange Rate' report below to demonstrate. To create an approval workflow using scripts, we first added the following visual columns:

* *Task Status* is a single-select data input column that has the options 'In Progress' (default option), 'Submit For Review', 'Reopened' and 'Approved'.
* The *Manager Approval* and *Director Approval* columns are also inserted as single-select dropdown columns with the list of values 'Pending', 'Approved', 'Rejected', and 'Reopened'.
* The *Manager Email*, *Director Email,* and *Associate Email* columns are inserted as person-type columns to select the approvers' and the requester's email ID(s).

The approval flow sequence is then scripted in each of these visual columns via the On Change Formula section. This is explained below:

#### Flow of script-driven approval workflow

1. After a user enters/updates a value in the 'exchange rate' data input field, the user should set the value in the *Task Status* column as 'Submit For Review'. The **On-Change Formula** section automatically runs scripts when data changes in the data input field, and it triggers an email to the manager.

<figure><img src="/files/MmyY5DZBxRcezN5mb1ej" alt=""><figcaption><p>The script in the 'Task Status' column</p></figcaption></figure>

2. In the *Manager Approval* single-select column, we’ve listed the actions as a script for each status change through the **On Change Formula** section. 

<figure><img src="/files/za1YE6wF5jjhHRSciEFv" alt=""><figcaption><p>The script in the 'Manager Approval' column in maximized view</p></figcaption></figure>

3. The **SETVALUE** function can assign a specific value to a related cell based on a condition. For example, when the *Manager Approval* status is ‘Approved,’ the SETVALUE updates the *Director Approval* status to ‘Pending’. Similarly, when the *Manager Approval* status is ‘Rejected’, it updates the *Task Status* column to ‘Reopened’.
4. If the director approves, the task status is updated to 'Approved'. Upon rejection, the status is set to 'Reopened' for both the *Manager Approval* and *Task Status* columns.
5. Notice how the approval-related columns are updated based on the approval or rejection at each level.

<figure><img src="/files/F751JpHDAETSV1ouvMEi" alt=""><figcaption><p>Approval workflow in action</p></figcaption></figure>

6. The **SENDMAIL** function will trigger email(s) to the specified recipients. You can optionally provide an email subject and summary, which will be in the email body. The email body will also contain the details of the updated values. 

<figure><img src="/files/kmezDfqcMRGj0EOtqFCE" alt=""><figcaption><p>Sample email triggered through the SENDMAIL function</p></figcaption></figure>

{% hint style="info" %}
**FAQs**

**Q1. Can I modify the scripting function as per my use case?**

Yes, you can customize the scripting based on your specific requirements. The example above uses a simple script to demonstrate how the approval workflow works, but you can extend or modify the logic to suit more complex business scenarios.

**Q2. Can I set up this flow without scripting?**

Yes, you can create an approval workflow without writing any scripts. [The next section](#id-2.-no-code-approval-workflows) explains how to configure approval workflows using the UI.

**Q3. Are approval levels configurable?**

Yes, you can add and configure as many approval levels as required.
{% endhint %}

### 2. No-code approval workflows

Not a fan of scripting? You can easily create approval workflows using the **Approval Workflow** user interface.

Unlike scripting, Plan automatically creates single-select dropdown columns and updates the status of all approval levels based on the status of their preceding or succeeding columns through the Approval Workflow UI.

To create an approval workflow, navigate to **Plan** > **Approval Workflow.**

#### Selecting the approvers

**STEP 1:** Enter the name for the first dropdown column by clicking on the **edit** icon. This creates a dropdown column with three preset options - **Submitted, In Progress, and Reopened -** for tracking the task status.

<figure><img src="/files/oqrsUNVIcvBbFrUlLY2Y" alt=""><figcaption><p>Editing the name for the first single-select column</p></figcaption></figure>

**STEP 2:** Select the email IDs of the report users who are authorized to update the task status from the search bar dropdown. In this case, 'Status' is a single-select dropdown column, and the requester's email ID is added. This person will be notified of the approver's action via an email.

<figure><img src="/files/szSApZuXSYwPl7WD70I2" alt=""><figcaption><p>Entering the requesters' email IDs</p></figcaption></figure>

**STEP 3:** Create the first-level approval by entering an appropriate column name and selecting the approver's email ID(s) from the search dropdown. In this case the 'Manager Approval' is a single-select dropdown column, and the approver's email ID is added.

<figure><img src="/files/b2Wi8uVrHGvUrFoju98O" alt=""><figcaption><p>Adding the first level of approval</p></figcaption></figure>

Alternatively, you can refer to a [text column](https://docs.fabricplan.com/planning/pages/m6YJeyIaNQ1IDxqgRFYV#id-1.-text) in the sheet containing the email addresses of users authorized to make changes to these two columns by selecting the **Column** option, as shown in the image below.

<figure><img src="/files/BaIF2pKMnBPx52RvJoQA" alt=""><figcaption><p>Selecting authorized users from the text column</p></figcaption></figure>

{% hint style="info" %}
Only when the sheet has one or more text-type columns does the **Column** option become active for the single-select columns mentioned above. Please make sure you select the appropriate text column that contains the email addresses.
{% endhint %}

**STEP 4:** Using the **Add** option at the top, you can insert the next level of approval, if required. After adding the required approval levels, click **Next**. In this example, the highest level of approval is the *Director Approval.*

<figure><img src="/files/XdSKSiur2InaNpbXasqu" alt=""><figcaption><p>Adding additional levels of approvals using the 'Add' option</p></figcaption></figure>

#### Customizing approval workflow

**STEP 5:** When you click **Next**, you will see a list of options for configuring the rejection and email notification settings.

<figure><img src="/files/oHEbJSJ3s0UL0w8MWLhx" alt=""><figcaption><p>Submit after configuring rejection options and email notifications</p></figcaption></figure>

* **Reset on Rejection:** Enabling this toggle will reset all the previous level statuses to 'In Progress' or 'Reopened' upon rejection. This option is disabled by default.
* **Email Notifications:** You can enable or disable email notifications for approvers and submitters using these two settings. These are turned on by default.

Click **Submit** to create the approval workflow.

#### How the approval workflow works

Plan automatically creates the single-select data input fields with a predefined set of options when you configure the approval workflow as explained above.

<figure><img src="/files/nbwc0vEqR2lcH0zrOPIk" alt=""><figcaption><p>Data input fields with predefined options automatically created by Plan</p></figcaption></figure>

In this example,

* When a value in the *Status* column is set to 'Submitted', an email notification is sent to the specified manager, and the corresponding *Manager Approval* status is automatically updated to 'Pending'.
* If the manager approves, an email notification is sent to the specified director, and the *Director Approval* status is updated to 'Pending'. Alternatively, if the manager rejects, an email is sent to the submitter, and the *Status* column is updated to 'Reopened'.
* The director can approve or reject the changes made. If the director rejects the changes, only the *Manager Approval* column status is updated to 'Reopened'.

<figure><img src="/files/2QWC9msaGwxnXt1cJDuM" alt=""><figcaption><p>Working of approval workflow</p></figcaption></figure>

In the above example, if the director rejects the request, only the *Manager Approval* (previous level) status is updated to 'Reopened', while the *Status* column value remains unchanged.

To update to the 'Reopened' status in all previous levels, enable the [**Reset on Rejection** ](#customizing-approval-workflow)toggle and click **Update**.

<figure><img src="/files/ZhNmyhFwnXiyFfRp9Y7P" alt=""><figcaption><p>Approval workflow with 'Reset on Rejection' enabled</p></figcaption></figure>


---

# 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.fabricplan.com/planning/approval-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.
