Announcement

Collapse
No announcement yet.

Sort Email Templates by field other than Date Created?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sort Email Templates by field other than Date Created?

    Hi,

    We have ~25 email templates we use in EspoCRM and occasionally add new ones. Is there a way to sort them automatically alphabetically instead of by Date Created?

    Like for example, we open the Email Template tab and "Name" is the default option to sort?
    Last edited by tpayne03; 12-27-2023, 05:29 PM.

  • #2
    1. In Your_Instance_Name/custom/Espo/Custom/Resources/metadata/entityDefs create a file EmailTemplate.json and add:
    - If the default sort should be Ascending, then add:​
    Code:
    {
        "collection": {
            "orderBy": "name",
            "order": "asc"
        }​
    }
    ​
    If the default sorting should be Descending, then add:
    Code:
    {
        "collection": {
            "orderBy": "name",
            "order": "desc"
        }
    }​
    2. Save changes to file and make Rebuild (in Administration > Rebuild).​
    Attached Files
    Last edited by yuri; 12-28-2023, 06:39 PM.

    Comment


    • #3
      Hi, I have copied the JSON array and am receiving error a Syntax Error in the data logs when I try to rebuild (Error 500 in Admin screen, check data logs and Syntax Error is noted in the logs)

      Is there a piece of syntax or a character that is off in the array?

      Freshly installed Espo 8.06 (coming from version 5 which ran for 6 years, but we moved to Office 365 and need the updated pack!).
      Last edited by tpayne03; 12-28-2023, 04:40 PM.

      Comment


      • #4
        Try to type the same JSON manually. Might be hidden characters present in the text (an issue of the forum software).

        Comment


        • #5
          tpayne03, yuri is right. The forum added extra characters to the code I suggested.

          I copied the code from my previous post

          Click image for larger version  Name:	image.png Views:	0 Size:	38.7 KB ID:	101135

          and pasted it into Your_Instance_Name/custom/Espo/Custom/Resources/metadata/entityDefs​/EmailTemplate.json:​​​

          Click image for larger version  Name:	image.png Views:	0 Size:	4.6 KB ID:	101132
          You should remove <0x200b>​​​​ and save the changes.

          Click image for larger version  Name:	image.png Views:	0 Size:	6.8 KB ID:	101133
          Attached Files

          Comment


          • #6
            Thank you both! I hand typed it, and indeed there is there is that hex. No problem using that array hand typed. Sorry, I wasn't aware the forum could put in characters!

            Comment

            Working...
            X