Show/Edit Field Only for Specific Role

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • IshitaRana
    Junior Member
    • Apr 2025
    • 17

    #1

    Show/Edit Field Only for Specific Role

    Hi,

    I have a custom field defined like this:

    PHP Code:
    "tMCheckStatus": {
        
    "type""enum",
        
    "options": [
            
    "Pending",
            
    "Done",
            
    "Not Applicable"
        
    ],
        
    "default""Pending",
        
    "style": {
            
    "Pending"null,
            
    "Done"null,
            
    "Not Applicable"null
        
    },
        
    "maxLength"100,
        
    "isCustom"true,
        
    "editable"true,
        
    "view""custom:views/fields/inline-edit-enum"

    I want this field (tMCheckStatus) and many more to be inlineeditable based on the role of the logged in user.

    Is there a way to configure this directly in the field’s metadata (e.g. using something like visible: inRole('tm') or readOnly), or do I need to handle this in a custom field view?

  • yuri
    EspoCRM product developer
    • Mar 2014
    • 9279

    #2
    Hi,

    I believe it's possible to use the field level security in Roles to achieve this.

    In every Role used in the system disable read or/and edit for all fields in question (in the Field Level section). Then, in specific Roles, override needed fields by enabling access to them.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment


    • yuri
      yuri commented
      Editing a comment
      In the future, we plan to have the ability to designate one mandatory role that will be always applied for all users. It will be easier to disable certain fields for all users.
Working...