Several businesses have long term projects or delivery schedules. At times in these businesses the payment is received after project completion. A project might continue for several months/years. To plan for revenues and profits in such businesses a concept of Present Value is important.

In this article we explain how Present Value can be calculated in Opportunity using Salesforce Flows. The Present value is defined as:

Where PV is Present Value, FV is Future value, r is the rate of interest and n is the time period in months. In our example the Future value is stored in the Opportunity object, the rate of interest and period are stored in custom fields. The Present value is also stored in a custom field, but it is a calculated value. When the amount, rate of interest or time period field changes, then a Salesforce Flow calculates the Present value and updates the corresponding Present Value.

### Introduction

Automation or the practice of having software and machines perform routine tasks is taking over and is here to stay in almost every industry around us. Salesforce Flows are precisely that. It is an automation tool that provides declarative process automation for the Salesforce app, experience, and portal. Salesforce gives us the functionality through Flow Builder to fully automate a guided visual experience and has very high functionality as it can be implemented in almost all processes to bring some form of automation.

Future Value can be defined as the value of a current asset at a specified date in the future based on an assumed rate of growth. Here, we have assumed there to be a constant rate of growth and a single future payment which is left untouched for the duration of the investment.Present Value can be defined as the current value of a future sum of money given a specific rate of return. The basic concept implies that a certain amount of money, let's say 10,000 Rs is worth more today as compared to the future. Hence, any amount received in the future is worth as much as the equal amount received today. It is calculated using three inputs which namely are:

**1: **Future Value (FV)

**2: **Rate of Interest/Inflation (r)

**3: **Time Period in months(n)

Present Value is essential in most businesses as it plays a critical role in fields like investment analysis, risk management, and financial planning. These metrics allow investors to judge the prices of investments with more clarity.

### Implementation Details

Here, we will be creating a two-screen flow where the first screen would be responsible for getting the required input variables from the user such as the future value, interest rate, and the time period in months. The second screen will be used to display the result.

As here, we donâ€™t need to store records. We can carry out the process by entering the input values into the formula field itself. We do not need to create variables to store values. However, that would not be the case if we needed the values produced by the flow to be stored. The flow will require two-screen elements, three input fields, and one formula field for execution. Here is a step by step guide of the following:

- We start by selecting a Screen flow as here we have to automate a business process that collects data from users. We can choose any layout, but free flow gives us more room to 0distribute elements in a way that makes it easier for us to understand.

- We start by adding one screen element on the flow and connecting the Start to the screen element. In this element we need to add three input components, which will be 2 number components for the interest rate (2 decimal places) and the time period in months (0 decimal places). The third input component would be of the currency type which would be the Future Value.

- We then go to the resource manager and get a formula field of the currency data type. It would represent the final Present Value with two decimal places, and enter the formula required given below.

- We then add another screen element which will be used to display the final Present Value calculated. Only one display text component is required as we do not take any input here. The display text will output the final value of the formula field as given below in the image.

- Connect the first screen to the second and save the process to have a Present Value calculator using Salesforce Flows !

### Example

In the first screen, we will enter the Future Value, Interest Rate, and the Time Period in months. Then we click on the next button to see the result

In the next screen we get the Present Value calculated as per the inputs.

### Summary

Screen-based flows are extremely useful in automating processes where Screens are needed to take inputs from the user and display the required information. It allows us to integrate various systems into one user-friendly interface. The main benefit is that it gives users the ability to configure process logic and be in full control of the design of the end-user experience without an extensive knowledge of Apex and programming principles.