Create Custom Table on EspoCrm

EspoCRM supports you in creating custom entities based on your business needs. Follow these steps to get started:


1. Access the Entity Manager

  1. Log in to your EspoCRM instance as an administrator.
  2. Go to Administration page, you can go from the left top menu.
  3. Thn search for Entity Manager.

2. Create a New Entity

  1. Click on Create Entity.
  2. Fill out the form:
    • Name: Enter the name of your custom entity. This will define the table name in the database (e.g., CustomEntity).
    • Type: Choose the type:
      • Base: For standard entities.
      • Person: If the entity is related to people (inherits fields like first name, last name).
    • Table: Define the database table name (optional). It will be filled automatically.
    • Enable Stream: Enables the activity stream (history tracking).
    • Choose Icon and Color: This icon will be shown in the navbar later on.
  3. Then create the entity.

3. Add Fields to the Entity

  1. In the Entity Manager, find your newly created entity. Or if you create from previous steps, it should be redirected to the entity configuration.
  2. Click on it to open the configuration.
  3. By default, it should have already preset fields added based on your chosen type on previous steps.
  4. Click Fields > Add Field to add custom fields:
    • Choose a Type (e.g., Text, Date, Enum, etc.).
    • Enter a Field Name (e.g., description).
    • Configure additional settings as needed (e.g., required, default value).
  5. Repeat for all required fields.

4. Configure Layouts

  1. Go to Layouts in the Entity Manager.
  2. Customize the layouts for your entity:
    • Detail View: The page displayed when viewing a record.
    • List View: The list of records.
    • Search Filters: Fields used in the search panel.
  3. Drag and drop fields to configure the layouts as needed.

5. Add to Navbars

  1. Go to Administration > User Interface.
  2. Choose Navbar tab
  3. In the Navbar tab, drag n drop your new entity. It usually at the very bottom of the list.

5. Apply the Changes

  • After saving the entity and configuring layouts, go to Administration > Clear Cache to ensure the new entity is loaded into the system.

6. Verify the New Table in the Database

EspoCRM automatically creates a corresponding table in the database when a new entity is added. You can verify this:

  1. Access your database (e.g., using phpMyAdmin or a similar tool).
  2. Look for a table with the name matching your entity, it shoud have prefix c_ (e.g., c_myentity).

After you successfuly add the custom entity to your EspoCrm, now you can easily fill the data from the dashboard or using api intergration.