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
- Log in to your EspoCRM instance as an administrator.
- Go to Administration page, you can go from the left top menu.
- Thn search for Entity Manager.
2. Create a New Entity
- Click on Create Entity.
- 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.
- Name: Enter the name of your custom entity. This will define the table name in the database (e.g.,
- Then create the entity.
3. Add Fields to the Entity
- In the Entity Manager, find your newly created entity. Or if you create from previous steps, it should be redirected to the entity configuration.
- Click on it to open the configuration.
- By default, it should have already preset fields added based on your chosen type on previous steps.
- 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).
- Repeat for all required fields.
4. Configure Layouts
- Go to Layouts in the Entity Manager.
- 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.
- Drag and drop fields to configure the layouts as needed.
5. Add to Navbars
- Go to Administration > User Interface.
- Choose Navbar tab
- 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:
- Access your database (e.g., using phpMyAdmin or a similar tool).
- 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.