Custom Object – 1 b45c39e0e5ab4cdf83c43df5eaede501

Custom Object – 1

Introduction

In this episode we are going to explore how to create a simple custom object in Salesforce, adding new fields, perform basic CRUD operation on custom object.

Steps to Create and Use Custom object

  1. Creating custom object with “Object Manager”
  2. Navigating and viewing newly created custom object
  3. Adding new fields in custom object
  4. Creating “Tab” for custom object
  5. CRUD operation on custom object

Step 1 – Creating Custom Object

We are going to create a custom object “Student”. To create a new custom object navigate to “Object Manager” tab in setup, hit “Create” button and select “Custom Object”

Untitled

Populate mandatory fields of the “Student” custom object and hit “Save”

Untitled

  • Label: Label of the object, added as “Student”
  • Plural Label: Plural label of the object, added as “Students”
  • Object Name: Used when referencing the object via API (in Apex class). It will be auto populated by using Label, but we can modify if needed
  • Record Name: Auto populated by appending “ Name” with object label, we can modify if needed
    • Data Type: Selected as “Auto Number”, so that we no need to fill this field manually
    • Display Format: Filled as “Stud-{0000}”. “Stud” is prefix string, and “{0000}” is auto generate number 0 padding format
    • Starting Number: Filled as 1. This is the starting number of the newly created record, so the Record Name would be “Stud-0001”, “Stud-0002”, etc.

Step 2- Navigating and viewing newly created custom object

Custom object and standard objects are listed under “Object Manager” tab in setup. You can search your object in “Quick Find” and view.

Untitled

The object view page is grouped with multiple tabs like Details, Fields & Relationships, Page Layouts etc. We can navigate to necessary section to view more details

Untitled

In the above image we are seeing “Details” section of the object which is having object basic information like singular and plural label, API name, Custom object indicator etc.

Defaults Fields of any Custom Object

Once the custom object created by default Salesforce will add following fields to the custom object.

  1. Created By – This field will store the user who is creating the record
  2. Last Modified By – This field will save the user who recently updated the record
  3. Owner – Owner of the record
  4. Name – Name field of the object and in our example it will be “Student Name”

Untitled

Step 3 – Adding new fields in custom object

Creating new field involve following activity

  • Navigating to object view “Fields & Relationship” section and start new field creation
  • Select field type of the field
  • Fill new field details like label, description etc.,
  • Configure field security by selecting profiles which are going view and edit this new field
  • Select layout where this new field will be added to view by the users

To add a new field navigate to “Fields & Relationship” of the object view and hit “New” button

Untitled

We are going to add “Full Name” field and field type is “Text”

Untitled

Populating field details.

Untitled

  • Field Label: added as “Full Name”
  • Length: added as 255 and that is the maximum value for text field
  • Field Name: Auto populated using “Field Label”, we can modify if needed

Selecting profiles which are going to view and update this field. If we want a profile to just view the field (read only) then select the “Read-Only” checkbox associated with the profiles name. In our example we are giving full access to all profiles.

Untitled

Selecting the page layout to include this new field. User can view this new field only if we add this field under page layout. In our example we have only one default layout and we are adding this new field under that. Click “Save” button to complete new field add.

Untitled

We can view the newly created field under “Fields & Relationship” section of object view page

Untitled

Step 4 – Creating “Tab” for Custom Object

By completing the above 3 steps we have created a new custom object, added new fields under that, configured security and layout of the new field. But still users cannot see our newly created object until we create a “Tab” for this custom object and including the new custom object tab under “Apps”.

New tab creation involve following activity

  • Fill tab details like selecting the custom object, selecting tab style etc.,
  • Select profiles to give access to this new tab. So only selected profiles can see this new tab
  • Select the “Custom Apps” to add this new tab under this menu

In Setup tabs are available under “User Interface” ⇒ “Tabs”. We can easily navigate to tab by searching “Tab” in “Quick Find” input. There are different type of tabs available and we are going to create “Custom Object Tabs” to show our newly created custom object to user. So click “New” button under “Custom Object Tabs” section

Untitled

Select Object and tab style.

Untitled

Select profiles to give access to this new tab. We are selecting all profiles in our example

Untitled

Selecting “Custom Apps” to add this new tab under this menu items. In our example we are selecting all “Custom Apps”

Untitled

Step 5 – CRUD operation on custom object

In our Step-4 we added our new tab under all “Custom Apps” so our new custom object is available under all “Custom Apps”. So to view our custom object as user we are gong to use “Sales Console” App.

If the user has more than one Apps access, then user can navigate to “Sales Console” app by searching that in “App Launcher”

Untitled

Once “Sales Console” App loaded we can see our custom object under main menu

Untitled

From main menu when we click our custom object name we will land in list view page of the custom object. List view page is used to view all records under the object in grid. You can create your custom list view by selecting columns to include and filter to apply. In this example we are not going to use only available default list views.

Landing page of custom object Student. Since we did not add any record it is empty. Click “New” button to add new record

Untitled

Fill “Full Name” and hit save. The tab icon (apple) is coming from the tab style which we selected.

Untitled

After saving the new student it will land in view page of the created record. We can edit and delete this record from object view page with menu option.

Untitled

If we navigate back to Student object list view from main menu (also refresh the screen) then we can see the newly created row

Untitled

Leave a Reply

Your email address will not be published. Required fields are marked *