Entity primary key field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Abdallatif
    Junior Member
    • Apr 2025
    • 1

    Entity primary key field

    Hi,
    I make an entity called People, this entity should has a primary key which is the ID for each person.
    When I make want to have the ID field as the primary key in the entity, I can't because there is existing one which is the name and it's type varchar, so I can't just rename it because the ID field type should be integer and have a conditional formatting to be only from 9 digits.

    How I can make the ID to be my primary key, no duplicates , and when I want to display the ID field in the , I need it to show as a link that can be clicked on it.

    Thanks in advance
  • lazovic
    Super Moderator
    • Jan 2022
    • 940

    #2
    Hi Abdallatif,

    EspoCRM by default uses id as primary key for all entities. This is a built-in behavior, and it is not possible to change the primary key to an integer field without tampering with the code.

    But you can create an integer field for your custom entity in your instance UI, set the "Required" option for it, and use it as a visual identifier on different layouts of the custom entity.

    More about fields you can find here: https://docs.espocrm.com/administration/fields.
    More about layouts you can find here: https://docs.espocrm.com/administration/layout-manager.

    Comment

    Working...