 Hello friends. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate you how you can create formula field in Salesforce Lightning. Before starting, let me show you how you can search in YouTube. You can type my name, my channel will be available there, and you can watch video Salesforce related videos here. So first of all, I'm going to open my university app. So let's understand the requirement first, why we need formula field to be created. So if I open any existing record, so here we have two fields, price and discount. So we need to calculate final price because we want this discount to be subtracted from the price. So if you want to do this calculation automatically with the help of a formula, and you want this formula to be updated whenever price and discounts are updated. So in that case, you can create formula field. So now I'm going to create formula field on book object. So here I'm clicking on new picking up formula. So let's read this description first. So here you can see, it is saying read only field that derives itself from a formula expression you define. Further says the formula field is updated when any of the source field changes. So these two things you need to keep in mind. So now I'm going to create a formula field. So its name will be final price. Then it has various written types. So right now I'm selecting currency because a formula will return a currency value. If you want to select any other as per your requirement, you can do so. And I'm also going to create separate playlist for formulas in Salesforce. So you can watch how to create different formulas that will be using these data types. So you can follow that also. So now here you can see the place where we can build a formula. So we have two options, simple and advanced formula for simple formula. You can use these operators for advanced formula creation. Salesforce provides various functions along with operators and a large number of operators are available here and you can select a category. And based on the category, these formulas are available. You can pick any formula for calculation. So now from insert field, I'm going to select price. So I'm going to multiply it with discount. So this is the formula I'm subtracting price into discount with price so that final price can be calculated. This discount is the person feeling. So whenever we create person field in Salesforce, it is by default divided by 100. So we don't need to do that. Now we can check our syntax. So it is saying there are no errors. You can write description and help text also. Then further it says if your formula references any number currency or person field specify what happens to the formula output when the values are blank. So if you don't put source field values, then what should happen? So there are two options free blank field as zeros or treat blank as blank. So I'm selecting first as zeros. Now it is asking for the field of security. So it should be visible for all the profiles, but it will be available in the only form. You cannot edit formula field. It should be available on the layout. So I'm clicking on save. I'm just modifying the layout so that it should be available below the price and discount. So I'm simply dragging and dropping it here and clicking on save. So first time making the refresh. So here you can see final price field is available and it is in readable mode. We don't have any pencil for editing it. So now I'm filling discount percent. So let's say it is 10 and I'm clicking on save. So you can see the result. 10% of 20,000 is 2000. So it is subtracted and the final price is available here. Now if I modify this, let's say it is 5%. So you will see the formula fields value or outcome will be modified automatically. So this way we can place a formula field using existing fields. Now if I go to any other record. So here you can see discount is not available here. So that's why prices as it final prices as it is as price. If you add discount here like 10% then 300 will be subtracted and the final price will be $2,700. So this way you can implement formula fields in Salesforce Lightning and it updates automatically whenever source fields are updated and it is available only in lead mode. You cannot modify it directly. So I hope you understood how we can create formula fields in Salesforce Lightning. If you want to watch more Salesforce related videos, you can search my name Sanjay Gupta on YouTube. Thank you for watching this video.