---
title: "SFDC: Add a formula field"  
description: "In my previous post SFDC: Add App Logic-Automate a field update using workflowwe learn how to populate a field automaticallyAnother thing that’s missi"  
author: "Anonymous User"  
published: 2015-03-16  
updated: 2018-02-15  
canonical: https://www.mindstick.com/blog/10835/sfdc-add-a-formula-field  
category: "sales force"  
tags: ["cloud computing", "cloud", "cloud development", "sfdc", "dev-401"]  
reading_time: 2 minutes  

---

# SFDC: Add a formula field

In my previous post *SFDC: Add App Logic-[Automate](https://www.mindstick.com/blog/12040/how-to-automate-your-business) a field update using [workflow](https://yourviews.mindstick.com/view/88561/claude-automation-auto-content-posting-workflow)* we learn how to [populate](https://www.mindstick.com/blog/60/populate-records-in-second-listbox-according-to-the-selection-in-first-list-box) a field automatically

Another thing that’s missing from the Line Item object is a Line Item Total field that displays the product of each Line Item’s Quantity and Unit Price. In this post, we implement this common [business logic](https://answers.mindstick.com/qa/30543/what-is-business-logic) by creating a new [formula field](https://answers.mindstick.com/qa/34177/what-is-a-formula-field-in-salesforce) in the Line Item object, again, without writing any code.

##### Calculate a Value for Each Line Item

##

In the first step, you’ll add a new [calculated](https://answers.mindstick.com/qa/31699/what-is-sensex-and-how-it-is-calculated) field called Line Item Total to the line item. This field multiplies the number of items with the price and [acts as](https://answers.mindstick.com/qa/51373/what-were-president-johnson-s-first-official-acts-as-president) a total for each line item.

1. Click Setup > Create > Objects.

2. Click the Line Item object and in the Custom Fields & [Relationships](https://www.mindstick.com/blog/11850/how-to-build-stronger-relationships-with-your-employees) related list, and click New.

3. Choose Formula, and click Next.

4. For Field Label, enter Line Item Total.

5. For Formula Return Type, choose [Currency](https://www.mindstick.com/articles/311850/currency-wars-what-they-are-and-how-they-work) and click Next.

![SFDC: Add a formula field](https://www.mindstick.com/blogs/389a4a83-c5c7-44c3-8841-2fdd21a33743/images/bf06fe81-5a89-4df3-b7ba-ed778ea088b9.png)

6. Click the Insert Merge Field drop-down list, and choose Unit Price. You should now see Unit_Price__c in the text box.

7. Click the Insert Operator drop-down list and choose Multiply.

8. In the Insert Merge Field drop-down list, select Quantity. You should now see Unit_Price__c * Quantity__c in the text box.

![SFDC: Add a formula field](https://www.mindstick.com/blogs/389a4a83-c5c7-44c3-8841-2fdd21a33743/images/81da9cbb-cc00-4a09-96e5-cefe105c14c8.png)

9. Click Next, Next, and then Save.

##### Try Out the App

##

To see the new Line Item Total formula field in action, you’ll need to create a new line item.

1. Click the Invoices tab and then click an existing invoice.

2. Add a new line item, select a piece of merchandise, and enter a quantity.

3. Save the line item and you can see the formula field in action.

![SFDC: Add a formula field](https://www.mindstick.com/blogs/389a4a83-c5c7-44c3-8841-2fdd21a33743/images/c2cf45e4-1fdc-47a0-b1e8-16cdd1a71b55.png)

**This document is referred from [salesforce help tutorials](http://www.salesforce.com/us/developer/docs/workbook/index.htm)

---

Original Source: https://www.mindstick.com/blog/10835/sfdc-add-a-formula-field

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
