Create Custom Fields in Salesforce and added to the App Tab:
(1) In this blog, we will learn how to create custom fields in Salesforce. After that, we use these fields in the Earthquake Tracker App developed in the previous blog. Learn here: How to Create a New Lightning App in Salesforce.
(2) On the Salesforce setup page click on the Object Manager as shown below.

(3) Now Object Manager Set Up page is opened. In the Quick Find box, search for the Custom Object (Earthquake Death Count) that we have created in the previous blog and click on it as shown below. Learn here: How to Create Custom Objects in Salesforce.

(4) Our Custom Object (Earthquake Death Count) page is opened. On the left side click on Fields & Relationships as shown below.

(5) Now our Fields & Relationships page is opened. On that page, you find some Standard Fields available here. You have to click on the New button to create New Custom Field as shown below.

(6) After that you find the list of data types that are available to choose from when it comes to creating fields. So there are some primary or preliminary data types like text, check box, date, email, phone, time, URL, etc. and then you have some relationship-related data types and also you have something called formula and auto number. In this example, we have the Earthquake Death Count object. What we want to do is we want to track the number of earthquake death cases country-wise. So these would be of the Data Type Number, so I will just go ahead and choose Number and click on Next as shown below.

(7) After that you have to fill in the necessary information and press the Next button as shown below. Note: Red Mark shows mandatory fields.


(8) In the Field-Level Security for Profile, I tick the Visible checkbox for System Administrator and then click the Next button as shown below.

(9) Now custom field add to the page layout and then click on the Save Button as shown below.

(10) Our field is created i.e. USA Death Cases. Now we have created two more Number Data Type fields i.e. UK Death Cases & UAE Death Cases as shown below. __c represents the custom field. Note: Follow the same step from 5 to 9 to create two more number fields.

(11) Now go to the app launcher and search for Earthquake Tracker App and click on it as shown below.

(12) Earthquake Tracker App is opened. In the Earthquake Death Counts tab, from the drop-down click on New Earthquake Death Count or click on the Earthquake Death Counts tab and press the New Button as shown below.

OR

(13) You find that the Custom fields created in the above steps are now seen in the New Earthquake Death Count pop-up. Fill in the information and then press the Save button as shown below.

(14) Now our first Earthquake Death Count record is created as shown below.

Create Custom Field Using Formula Data Type:
(1) Formula Data Type is used to calculate the total number of death cases i.e. summation of USA, UK, and UAE Death cases.
(2) Now again go to the Fields & Relationships page and click on the New button to create New Custom Field as shown in step 5 above.
(3) Now you have to select the Formula Data Type and click on the Next button as shown below.

(4) In the next step, fill the Field Label box, Field Name is automatically generated. In the Formula Return Type, select Number and set Decimal Places to zero, and then press the Next button as shown below.

(5) In the Enter formula step, you have to Enter your formula and click Check Syntax to check for errors.


(6) In the Field-Level Security for Profile, I tick the Visible checkbox for System Administrator and then click the Next button as shown below.

(7) Now custom field add to the page layout and then click on the Save Button as shown below.

(8) New Formula Data Type Field is created as shown below.

(9) Now go to the Earthquake Tracker App and click on the Earthquake Death Count Name record created above as shown below.

(10) It shows the Total Earthquake Cases field as shown below.

Comments (No)