﻿# Use cases for customizing process indicators

> [HTML Version](business-process-metrics-examples.html)

## Indicator of the Counter type

Let's see how to customize the indicator using the **Draw up and approve the contract** process as an example. It consists of the following steps:

1. The sales rep prepares the contract and sends it to the manager for approval.

2. After the manager reads the contract, they can reject it, send it for revision, or approve it.

3. If the contract has been sent for revision, the sales rep will get a task for making corrections. Then, the contract will be resubmitted to the manager for approval.

4. If the contract has been approved, the sales rep will arrange a meeting with the customer and the parties will sign the contract.

You can add an indicator to the process to count how many times the sales rep has resubmitted the contract for approval after revision. This will allow you to analyze the employee's work by tracking the number of iterations until the contract is correctly executed.

### Step 1: Create an indicator of the Counter type

[Create an indicator](business-process-metrics.md#create-indicator) of the **Counter** type, e.g. **Number of rejections**, and publish it.

### Step 2: Set up a business process with an indicator of the Counter type

1. Go to the designer of the **Draw up and approve the contract** business process.

2. To find out how many times the sales rep has resubmitted the contract for approval after revision, use the [Set Indicator’s Value](set-process-metrics-value.md) activity. Place it on the process diagram after the **Make corrections to the contract** task.  
**(business-process-metrics-examples-1.png)**

3. Double-click the activity and open its settings. Then enter a name and specify the** Number of rejections** indicator.   
  
For an indicator of the **Counter** type, fill in the **Action** field. To record how many times the contract has been resubmitted for approval, select **Incrementing the counter**.  
**(business-process-metrics-examples-2.png)**

You do not need to fill in the data on the **Field Values** tab. In this example, only the [system properties of the indicator](business-process-metrics.md#context-property) are used, into which the values from the process are automatically written.

4. Save the activity settings and publish the process.

### Step 3: Customize the chart for the Counter type indicator

1. Create a separate page and place the [Chart](chart.md) widget on it. This way you will be able to visualize the data after the execution of a process instance with an indicator.

2. In the widget settings on the **Chart** tab, fill in the fields:  
**(business-process-metrics-examples-3.png)**

- **Data source**. Select **Indicator**.

- **Indicator**. From the list of published indicators, select **Number of rejections**.

- **Category**. Specify the **Event author** property to see which sales reps performed the task to revise the contract.

- **Chart indicator**. Select **Amount** to display how many times the event author performed the task.

- **Data display**. Select **Units**.

- Leave the rest of the settings as they are by default.

3. On the **Custom Filters** tab, you can select the properties of the indicator to filter the data on the chart. To track the number of times an employee worked on a task over a certain period, select **Event time**.

4. Save the widget settings and publish the page.

A manager can specify a period and view on the chart how many times a sales rep has performed a task to revise a contract. The indicator includes all completed instances of the process during this period. If several sales reps are involved in contract finalization, you can compare the efficiency of their work.  

**(business-process-metrics-examples-4.png)**

## Indicator of the Value type

Let's see how to customize the indicator using the** Approve the deal amount** process as an example. It consists of the following steps:

1. The sales rep prepares a draft contract and specifies a preliminary deal amount in it. To do this, they fill in the **Amount** field on the task form.

2. Then they discuss the draft contract with the customer and offer additional services.

3. If the customer agrees to purchase the services, the sales rep changes the deal amount. To do this, they use the same **Amount** field as for the preliminary amount.

With the help of the indicator, we can track the difference between the preliminary and the final amount of the deal and display it on the chart.

### Step 1: Create an indicator of the Value type

1. [Create an indicator](business-process-metrics.md#create-indicator) of the **Value** type. For example, **Deal amount change**.

2. Add properties to the [context of the indicator](business-process-metrics.md#context-property) to record two amounts from the process. To do this, go to the **Context** tab and add the **Deal amount** variable of the [Category](360009707032.md#category) type. Set the values: **Preliminary deal** **amount** and **Final deal amount**.

3. Publish the indicator.

### Step 2: Set up a business process with an indicator of the Value type 

1. Go to the designer of the **Approve the deal amount** business process.

2. To record the value of the preliminary and the final amount, place the [Set Indicator’s Value](set-process-metrics-value.md) activity before and after the **Offer additional services to the customer** task on the flow chart.  
**(business-process-metrics-examples-5.png)**

3. Double-click the activity that is placed before the discussion of the additional services and go to its settings. Name it **Preliminary amount** and specify the **Deal amount change** indicator.  
  
Then, on the **Field Values** tab, fill in the data so that the values from the process are passed to the indicator:  
**(business-process-metrics-examples-6.png)**

- **Deal amount**. Select the indicator variable and map it to the **Preliminary deal amount** value. Thus, the amount before the discussion with the customer will be recorded as the **Preliminary deal amount**.

- **Value**. Select the system property of the indicator and map it to the process context **Amount** variable, in which the sales rep specifies the deal amount at this step.  

4. Double-click the activity that is placed after the discussion of the additional services and go to its settings. Name it **Final amount** and specify the **Deal amount change** indicator.  
  
On the **Field Values** tab, specify the variables:

- **Deal amount**. Map the indicator variable to the **Final deal amount** value. As a result, the deal amount after the discussion with the customer will be recorded as** Final deal amount**.

- **Value**. Map the system property of the indicator to the process context **Amount** variable, where the sales rep enters the new amount after revising the contract.

5. Publish the process.

### Step 3: Customize the chart for the Value type indicator

1. Create a separate page and place the [Chart](chart.md) widget on it to visualize the indicator.

2. In the widget settings on the **Chart** tab, fill in the fields:  
**(business-process-metrics-examples-7.png)**

- **Data source**. Select **Indicator**.

- **Indicator**. From the list of published indicators, select **Deal amount change**.

- **Category**. Specify the context variable of the **Deal amount** indicator to display the preliminary and the final amount on the chart.

- **Chart indicator**. Specify the **Value** indicator field and select **Value**. Then the chart will display the numeric values entered by the sales rep in the **Amount** field on the **Prepare the contract draft** and **Offer additional** **services to the customer** task forms.

- **Data display**. Select **Units**.

- Leave the rest of the settings as they are by default.

3. On the **Custom Filters** tab, you can select indicator properties to filter data on the chart. To track the difference between the preliminary and the final deal amounts for the period, select **Event time**.

4. Save the widget settings and publish the page.

The manager can specify a period and view the values recorded for the preliminary and the final deal amounts on the chart. The indicator includes all completed process instances for that period.

**(business-process-metrics-examples-8.png)**

## Indicator of the Time Interval type

Let's see how to customize the indicator using the **Issue a contract** process as an example.

With the help of this indicator, you can find out how much time a sales rep spent on the task for issuing the contract. You can record the task start and end dates using a script.

### Step 1: Create an indicator of the Time Interval type

[Create an indicator](business-process-metrics.md#create-indicator) of the **Time Interval** type. Name it, e.g **Task execution duration**, and publish it.

### Step 2: Set up a business process with an indicator of the Time Interval type

1. Go to the designer of the **Issue a contract** business process.

2. On the **Context** tab, add the **Task start date** and **Task end date** variables of the [Date/time](360009707032.md#date-time) type. The task start and end times will be recorded in them.

3. On the **Scripts** tab, add the following commands:

````
async function start\_time(): Promise<void> \{  
    Context.data.task\_start\_date = new Datetime();  
    \}  
    async function finish\_time(): Promise<void> \{  
        Context.data.task\_end\_date = new Datetime();  
    \}

4. ````
Go to the process flow chart. Add the [Script](360027203731.md) activities: place one before the **Issue a contract** task and the second one after it.  
**(business-process-metrics-examples-9.png)**

5. In the settings of the **Script** activity for recording the date of task assignment, specify the \[OBJECT\] function. In the activity settings for recording the completion date, specify the \[OBJECT\] function. 

6. To pass to the indicator the time from the assignment and to the completion of the task, use the [Set Indicator’s Value](set-process-metrics-value.md) activity. Place it on the scheme of the business process after the script and task activities.

7. Double-click the activity and customize its settings. On the **Main** tab, enter a name, e.g. **Record time interval**, and select the **Task execution duration** indicator.  
  
On the **Field Values** tab, fill in the data to pass the values from the process to the indicator:

- **Beginning of interval**. Select the [system property of the indicator](business-process-metrics.md#context-property) and map it to the process context **Task start date** variable. This way you will pass the task assignment date to the indicator.

- **Interval end**. Select the indicator property and map it to the process **Task end date** variable. Then you will pass the task completion date into it.  
**(business-process-metrics-examples-10.png)**

8. Publish the process.

### Step 3: Customize the chart for the Time Interval indicator

1. Create a separate page and place a [Chart](chart.md) widget on it to visualize the indicator.

2. In the widget settings on the **Chart** tab, fill in the fields:  
**(business-process-metrics-examples-11.png)**

- **Data source**. Select **Indicator**.

- **Indicator**. From the list of published indicators, select **Task execution duration**.

- **Category**. Specify **Event time** and select **By dates**. This way you will be able to see how long an employee performed a task on a certain day.

- **Chart indicator**. Specify **Value** and select **Average**.

- **Data display**. Select **Units**.

- **Chart type**. Select **Number cards**.

- Leave the rest of the settings as they are by default.

3. On the **Custom Filters** tab, you can select the indicator properties to filter the data on the chart. To track a specific employee's work on a task, select **Event author**.

4. Save the widget settings and publish the page.

The manager can select a sales rep’s name and view on the chart how many hours elapsed from the time the task was assigned until the employee closed it. The indicator includes all completed process instances for the day.

**(business-process-metrics-examples-12.png)**