Salesforce Menu

How to Create an Custom Objects in Salesforce

Let’s create our first object for Warehouse app i.e Merchandise (as we mentioned above that we need to create 3 objects for this application), below are the steps which you guys need to follow to create a custom object in Salesforce:

Step 1. After loging into your Salesforce developer org, click Setup >Build >Create>Objects.

Step 2. At the top of the page, click New Custom Object button to open the wizard.

Step 3. In the Label field, enter the singular version of the object name which in our case will be Merchandise.

Step 4. In the Plural Label field, enter the plural version of the object name which in our case will be Merchandises

Step 5. Enter a short description of this object (like what it will be used for) in the Description field. This is a best practice so make sure to get into the habit of providing a description for everything you create.

Step 6. In the Enter Record Name Label and Format section, it will take Merchandise Name field by its own where its datatype is Text. If you want you can change its datatype from text to auto number. If you changed text to Auto number below points you need to take care:

  I. In the Data Type field, choose Auto Number
  II. In the Display Format field, enter Merchandise-{0000}
  III. In the Starting Number field, enter 1

Note: in our example, we are taking Merchandise Name where datatype is Text, after creation of the object, this field will come under standard filed section.

Step 7. In the Optional Features section, check the boxes for Allow Reports (if you want to use this object for reporting purpose), Allow Activities and Track Field History.

Step 8. In the Object Classification section, please confirm that all boxes are checked.
Step 9. In the Object Creation Options (available only when custom object is first created)section, check both boxes (Add Notes and Attachments related list to default page layout and Launch New Custom Tab Wizard after saving this custom object).

Congratulation! You’ve now created your first custom object. Now let’s create a custom field, please refer next section i.e. “Create Fields in Salesforce” or <Link for Create Fields in Salesforce>

In Lightning Experience:  How To Create An Custom Objects In Salesforce

Step 1. Click from right top side in your screen and then click Setup

lightning-exp-create-app-salesforce

Step 2. From the Home tab in Setup, enter Object in the Quick Find box, then select Object Manager.

lightning-exp-object-manager

Step 3. Click Create and then Click Custom Object.

lightning-exp-object-manager-setup

Step 4. In the Label field, enter the singular version of the object name. In the Plural Label field, enter the plural version of the object name.

lightning-exp-new-custom-object

In the Enter Record Name Label and Format section, it will take LightningObj Name field by its own where its datatype is Text. If you want you can change its datatype from text to auto number. If you changed text to Auto number below points you need to take care:

  1. In the Data Type field, choose Auto Number
  2. In the Display Format field, enter LightningObj-{0000}
  3. In the Starting Number field, enter 1

In the Object Classification section, please confirm that all boxes are checked.

Finally, Click Save button

lightning-exp-enter-record-name-label-format

Step 5. New object is created successfully as below.

lightning-exp-new-object-created

Note: in a similar way, please create other remaining 2 Objects named as LineItem and Invoice for this application to achieve complete end to end functionality of the application.

Let us discuss custom object definition in more details as below:

CUSTOM OBJECT LABEL AND PLURAL LABEL:

When we are creating a custom object, Salesforce asks for the singular as well as plural version of what you want the object to be called. The purpose for this is so that the language used on buttons and other areas of Salesforce are grammatically correct. For example, if we entered Merchandise as the value for the field Label, the button we would use to create the Merchandise on the Account object would read New Merchandise instead of New Merchandise. Since we are technically creating one new Merchandise record at a time, the word Merchandise is incorrect.

AUTO NUMBER VS TEXT NAME FIELD

An Auto Numbers can replace the text name field of a record. Instead of having to fill in every name field for every Merchandise, Salesforce will generates a unique number for each and every record. This is a great option for this type of record because the name would more than likely be the same for every Merchandise. Using this distinctivenumber, it reduces the number of fields to fill out and provides us a reference number which can be searched and reported on in Salesforce.

The Display Format field allows us to customize how the auto number should displays.

Optional Features
The remainder of the custom object creation page are permissions and properties of the object. Here is what each one does.

Allow Reports – checking this box allows the object to be visible in Salesforce reports. This box should always be checked. I can not think of any reason why this box would not be checked until it will ask explicitly.

Allow Activities – when this check box is checked, users will have the ability to create tasks and events on the record. I usually prefer to check this check box in the beginning. If the client decides we don’t need to have activities on the object, it can always be removed as per need.

Track Field History – it will enable the ability to track changes in the specific field values. This is important for records where an “audit trail” of the changes are needed to track. Activating field history tracking also allows you to generate a report on these changes as per need.

Add Notes & Attachments related list – To check this box allows users to add notes and upload attachments to the record. Again, I would prefer to activate this in the beginning and remove it later if client needed.

Launch New Custom Tab Wizard – this option is only available when creating Launch New Custom Tab Wizard – this option is only available when you are creating a new custom object. An object must be associated with a tab in order to be listed on the tab menu at the top of the page or to be accessible as a stand-alone object. Some times there are reasons when you may not want to create a custom tab, like if you want to force users to access the data only through a related record.

Wonderful! Now that we have gone through the creation process and reviewed all of our options successfully, let us complete the creation of this object. We will click Save at the bottom of the page to save our newly created object settings as well as launch the custom as a tab.

On the Newly Custom Tab page, click the magnifying glass icon next to the Tab Style. This will allow you for selecting an icon and color scheme for the new tab. For the Merchandise object, let’s choose the Wrench. Once selected, click on Save to complete the tab setup.

Now that the Merchandise custom object is created, but use the following settings to create this object.

Object Name – Use Merchandise as an object name. Please Don’t forget to give the plural of the object name in the appropriate field.

Record Name – Leave this as text rather than Auto Number. This will allow us to enter the specific name of the Merchandise like computer.

Tab Style – when selecting a tab style from the Custom Tab Wizard, choose computer.

Types of Objects

There are two types of objects in Salesforce. They are:

Standard Objects

These are the in-built objects that are automatically provided once we start using salesforce. These support a lot of the common CRM functionality like Services, Sales, Lead generation and retention etc.
Some examples of standard objects are : Account, Contact, Opportunity, Lead etc.

Custom Object

These are the objects which are created by the salesforce users/admins inside their own salesforce environment. These are specific to the business requirement for a particular user.
These contain “__c” next to their API names which helps us determine if it is a custom object or not.

Subscribe Now