Author: Rahul Dusaje
This blog will help us to create the custom objects in salesforce lightning.
- Although, salesforce gives us standard objects in the developer edition(free) to store data. However, custom objects come handy to store specific data and its schema can be designed as per the requirement.
Salesforce Lightning account. If you don’t have one, you can create from here
To create salesforce custom objects.
- Create a salesforce lightning account.
- Navigate to Setup(top right) -> Create -> Custom Object
Object Manager: It is a pool where all the standard and custom objects are accessible for an organization with API Name and Label.
3.1) Define properties such as Label, Plural Label, Object Name in Custom Object Information. For instance, we are creating an Employee object.
3.2) Define Record Name Label and Format.
Here, we are defining a field Employee S.No. as an Auto Number field with a standard display format and starting number 1.
Congrats, your first salesforce custom API is ready! ( __c denotes that it is a custom object).
Now let’s define Fields for this object.
3.3) Hover to Fields & Relationships. Click New.
Define the Data Type of the field. Since, this is going to be a Name field; the supporting data type would be Text.
Click Next and define the attributes for this field.
You can mark it as External ID in order to refer to the records in this field from the external system in upsert or update calls.
Click Next and set the field level security to make them editable or read-only
Here, I have created one more field(Contact Number) of datatype Phone to store the contact details of the employees.
4) Now the Custom Object is ready to store the data. Furthermore, we will create a Custom Tab in order to display the data stored in the custom object. For that navigate to Setup and click on Create -> Custom Tab
Here, define the Object(custom object), Tab Style(to let users easily identify the tab among the plethora of tabs) and description(optional) of the tab.
4.1)Click Next and you have the authority to enable this tab for the users to view it as per the profile.
4.2)Click Next to enable this tab to the Custom Apps and Save.
Now the custom tab is ready!
5.1) To view this tab, goto App Launcher on top left and search for employees.
5.2) Goto List Views and hit All. Now we need to add the field that we created( Name, Contact Number). For that, goto List View Controls and click Select Fields to Display.
5.3) Now add the two fields. You can display all the required fields as per the requirement.
Congratulations, your first custom object and custom tab is created!