blog

Home / DeveloperSection / Blogs / SFDC: Add a formula field

SFDC: Add a formula field

Anonymous User3077 16-Mar-2015

In my previous post SFDC: Add App Logic-Automate a field update using workflow we learn how to populate 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 by creating a new formula field 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 field called Line Item Total to the line item. This field multiplies the number of items with the price and acts as a total for each line item.

1.       Click Setup > Create > Objects.

2.       Click the Line Item object and in the Custom Fields & Relationships 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 and click Next.

SFDC: Add a formula field

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

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

**This document is referred from salesforce help tutorials


I am a content writter !

Leave Comment

Comments

Liked By