Customizing Email Template List (small) layout: ordering, columns and search box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jhack_jos
    Junior Member
    • Apr 2025
    • 14

    #1

    Customizing Email Template List (small) layout: ordering, columns and search box

    Thank you in advance to anyone whom has any suggestion.

    ISSUES
    I would like to ask for any work around you know to do the following:

    1. change default order to "order alphabetically by name" for the Email Template List (small) Layout?
    2. edit the Email Template List (small) layout, and delete the user assigned column?
    3. set the search box for Email Templates List (small) view to search only in the name of the Email Template, and not the subject of the email?

    We are able to change code (php, json, javascript) if needed to obtain the needed result, but since we are just starting with EspoCRM we do not yet understand where to do the needed modifications.

    WHY THIS WOULD BE IMPORTANT TO US
    We use a lot of templates in my team, but the most used ones are just the top 10.
    As such, we would like to order the templates in a smart way, from the most used one, to the least used one.
    So we thought: why not to put a number before the template, and than order alphabetically?
    Es.

    0. First Template
    1. Second Template
    2. Third Template
    and so on.

    Now, we figured a few problems with this approach:
    1. EspoCRM remembers the last ordering used in the Email Templates Edit view, but not in in the Email Template selection view:
      1. If you click on Email -> Email Templates, order is kept in the list view
      2. if you compose an email and click on the small arrow symbol "^" in order to select a template , ordering is always "by creation date"
      3. for some reason, the List layout and List (small) layouts are not editable from the Layout manager for Email Templates
    2. if you put a number in font of the template, search functionality stops working unless you split the check in Administration -> Settings -> General -> "use 'contains' when filtering varchar values". Yet this brings its own problems:
      1. if we search for a word, it seems that templates that contain that word in the subject of the message are also listed, and search is not done only in the Email Template "name" field
      2. this means that many extra templates are listed in our case, because most our templates subjects are similar
      3. I know we could just search by number since we use template names like "0. Template name", but team members that are not accustomed with the arbitrary numbers give to each template will be confused by this. I also feel this may not be the way this functionality is supposed to work, since looking for the subject of the email does not seem very helpful, at least in our use case.
    About the "user assigned" column, we would like to delete it for convenience to improve usability from mobile, since on mobile space is of the essence. As of now, mobile users fail to see the whole "name" column for the template, because of the space the "user assigned" column eats up.


    We truly appreciate any help you could give us!
    Warmest Regards,

    Jacopo
    Last edited by jhack_jos; 05-09-2025, 12:37 PM.
  • victor
    Active Community Member
    • Aug 2022
    • 904

    #2
    You have described the current functionality for Email Templates. You will not be able to do anything through the Email Templates GUI. Therefore, this topic is better placed in the Developer or in the Feature Request section.

    Comment

    • jhack_jos
      Junior Member
      • Apr 2025
      • 14

      #3
      Thank you for the helpful guidance, Victor. Sorry about that. I will create again this topic in the Developer section, as you recommended.

      Comment

      • yuri
        Member
        • Mar 2014
        • 8942

        #4




        Create custom/Espo/Custom/Resources/metadata/entityDefs/EmailTemplale.json:

        Code:
        {
            "collection": {
                "orderBy": "name",
                "order": "asc",
                "textFilterFields": ["name"]
            }
        }

        Create: custom/Espo/Custom/Resources/layouts/EmailTemplate/defaultSidePanel.json

        Code:
        [
            {
                "name": "teams"
            }
        ]
        This will change the side panel fields layout for all views.
        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

        • jhack_jos
          Junior Member
          • Apr 2025
          • 14

          #5
          Thank you for the link to the documentation and the precious information Yuri! Your insights helped us to solve all issues we had.
          I only have one question:
          • I added the "custom/Espo/Custom/Resources/layouts/EmailTemplate/defaultSidePanel.json" file as you recommended, but I could not understand its effect.
            What is it supposed to do? If I may ask, what are "defaultSidePanels"?

          A few notes on the actual steps we needed to fix everything, for anyone interested:
          1. Creating the file "custom/Espo/Custom/Resources/metadata/entityDefs/EmailTemplate.json" helped in making the text filter working only on the name of the template, and enforcing the order in which the templates are shown as "ascending by name", just as described in the documentation you provided.
          2. Reading the documentation I also managed to create "custom\Espo\Custom\Resources\layouts\EmailTemplate \listSmall.json" and "custom\Espo\Custom\Resources\layouts\EmailTemplate \list.json" in order to delete the "assignedUser" column by adding the following code inside the files:

            Code:
            	[
            	{"name": "name", "link": true},
            	{"name": "createdAt", "width": 22}
            	]
            This works because it overrides the content of the files in the "application\Espo\Resources\layouts\EmailTempl ate" folder, which originally contained:

            Code:
            	[
            	 {"name": "name", "link": true},
            	 {"name": "assignedUser", "width": 22},
            	 {"name": "createdAt", "width": 22}
            	]
          3. I do recommend anyone trying to do the same type of customizations to load in Visual Studio Code the JSON schema provided in the EspoCRM source code which can be found on GitHub . To do so you shall copy the ".vscode" and the "schema" folder at the root of your EspoCRM folder, and then open the root folder as a project inside Visual Studio Code.
            1. Link to the .vscode folder: https://github.com/espocrm/espocrm/tree/master/.vscode
            2. Link to the schema folder: https://github.com/espocrm/espocrm/tree/master/schema
          Last edited by jhack_jos; Today, 08:06 PM.

          Comment

          Working...