Ability to adjust default filter under any entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • khopper
    Senior Member
    • Sep 2017
    • 329

    Ability to adjust default filter under any entity

    Ability to add and customize default filters for all users via GUI. As the DB grows it takes longer and longer to load a page/entity such as accounts and or opportunities because the default is to show all items within that entity. Currently in my db as an example is takes 4 sec for the accounts screen to show any items. If I add a filter manually for example the last 30 days it takes less than 1 sec to display and move on.
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    In the next version lists should load a bit faster.
    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

    • khopper
      Senior Member
      • Sep 2017
      • 329

      #3
      A little faster but still takes 2-3 seconds to display "Accounts".
      Can I add a default filter via GUI to display the last 30 days by default for all users? (takes less than .5 seconds to display this way)

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        how many records per page do you display?

        Comment

        • khopper
          Senior Member
          • Sep 2017
          • 329

          #5
          30 results at a time....top right corner shows the total number of 11,800+ records.

          Comment

          • tanya
            Senior Member
            • Jun 2014
            • 4308

            #6
            Hi,
            add here (in your instance) https://github.com/espocrm/espocrm/b.../Base.php#L263
            if ($entityType == "{YourEntityName}") {$GLOBALS['log']->error($sql);}

            After go to list view. then remove added row.
            Now you can check the sql, built for getting the list. Do you see, how to optimize the query?

            Comment


            • khopper
              khopper commented
              Editing a comment
              I will live with it as is for now, until it 1. becomes unbearable or 2. its added as a feature through updates/enhancements.
          • olof
            Senior Member
            • Jul 2018
            • 184

            #7
            Hi Khopper, 3 s comes for 11k records sounds unviably slow (we haven’t load tested yet). I was viewing a Espo as speed orientated but we have more accounts than that on our 10 year old sugar system and it loads in sub 300ms.

            What server spec are you using? CPU, RAM, SSD? Are you apache or Ngnix?

            olof.

            Comment


            • khopper
              khopper commented
              Editing a comment
              It's just the Accounts List. I have it limited to display the first 30 records but it does give you count of all records in the DB.
              Everywhere else it is is no problem. I have been considering upgrading my equipment to SSD's

              VMware ESXi Host - Dell PowerEdge R710, 2 - Xeon L5520 2.27 GHz, 64GB RAM, 6 - 1TB 7200 RPM Drives in Raid 5, 4-Port 1GB
              VM Specs -1 CPU - 4 cores, 4 GB RAM, 500 GB HDD, 1GB NIC
              Ubuntu LTS 14.04, Apache2, MySQL 5.6
              Last edited by khopper; 07-22-2018, 02:29 PM.
          • khopper
            Senior Member
            • Sep 2017
            • 329

            #8
            Here is a screen shot of the load time using the developer tools in chrome.
            No Filters, all I did was a refresh on the Accounts Screen.
            I even dropped it to showing the first 20 records from what it was at 30 records.
            This was with only 1 user logged into the system being myself.

            Last edited by khopper; 07-22-2018, 04:28 PM.

            Comment

            • khopper
              Senior Member
              • Sep 2017
              • 329

              #9
              This would be a great Feature to be able to manage via the GUI! Currently Running Version 5.3.6

              Comment

              • beeline
                Junior Member
                • Jan 2023
                • 6

                #10
                Did this feature ever arrive? I haven't seen it. I have an Entity called Staff of which there are currently 50 records. 9 are Inactive and so I never need to see the record, but don't want to delete them for obvious reasons. It would be great if I could set my Staff Entity to auto filter Active staff.

                Comment

                • victor
                  Active Community Member
                  • Aug 2022
                  • 727

                  #11
                  beeline,

                  If you work mainly from one browser (not from an incognito tab), then the filters that you set in your entity in Administration > Entity Manager > Your_Entity_Name > Layouts > Search Filters are enabled, then the filter you set is saved until you clear the browser cache.

                  However, Report Filters may be more suitable for you:

                  Auf YouTube findest du die angesagtesten Videos und Tracks. Außerdem kannst du eigene Inhalte hochladen und mit Freunden oder gleich der ganzen Welt teilen.

                  Comment


                  • rabii
                    rabii commented
                    Editing a comment
                    hey victor,

                    is there anyway to force a list view to be loaded with a preselect filter, e.g accounts when the list view is loaded by default it should load (Recently Created) instead of All.

                    when selecting a link we could apply a getSelectPrimaryFilter or getSelectBooleanFilter to load the select-modal with predefined filter like here https://github.com/espocrm/espocrm/b...ed-user.js#L49
                    but when i looked into the code base for the list view i couldn't find anything that allow such ability. i am missing something or is this not possible now ?

                    Thanks

                  • victor
                    victor commented
                    Editing a comment
                    rabii, I think, this is answer https://forum.espocrm.com/forum/gene...7196#post47196

                  • rabii
                    rabii commented
                    Editing a comment
                    i have tried it but didn't work, can you try it your end and let me know if it works, i have tried all variations as below and none of them worked:

                    tried this at first and didn't work:

                    "defaultFilterData":{
                    "primary":"recentlyCreated"
                    },

                    Also tried and didn't work

                    "defaultFilterData":{
                    "name":"recentlyCreated"
                    },

                    and tried this also didn't work

                    "defaultFilterData":{
                    "filter":"recentlyCreated"
                    },

                    Tried this for the account entity hence recentlyCreated is a primary filter.
                • lazovic
                  Super Moderator
                  • Jan 2022
                  • 809

                  #12
                  Hi rabii,

                  I added the following to the custom/Espo/Custom/Resources/metadata/clientDefs/Account.json file:


                  "defaultFilterData": {
                  "primary": "recentlyCreated"
                  }

                  Everything worked fine for me after making rebuild and page refreshing. Please try one more time and let me know.

                  For the best effect, try to test if the changes worked by going to the anonymous tab and logging into your instance as any user that has access to Accounts.
                  Last edited by lazovic; 05-19-2023, 10:59 AM.

                  Comment


                  • rabii
                    rabii commented
                    Editing a comment
                    Thanks for sharing this.
                    It seems i was only testing this using admin user session where this doesn't apply, it only applies to regular (non-admin) users. this is a very cool option.

                    Not sure if there is any option to force this for admin users as well?
                • lazovic
                  Super Moderator
                  • Jan 2022
                  • 809

                  #13
                  rabii,

                  After clearing the browser cache, everything will work for the administrator too in the general (non-anonymous) tabs.

                  Comment


                  • rabii
                    rabii commented
                    Editing a comment
                    i see
                    thanks
                • victor
                  Active Community Member
                  • Aug 2022
                  • 727

                  #14
                  Originally posted by lazovic
                  rabii,

                  After clearing the browser cache, everything will work for the administrator too in the general (non-anonymous) tabs.
                  My tests, like the rabii tests, failed because of the cache.
                  Personally, I used a regular browser and an incognito tab. I updated the page, made Rebuild, made Rebuild Report Filters (because I set the Report Filter as the default).

                  My mistake was that I cached both the regular browser and the anonymous tab, although I thought I had eliminated this factor.


                  And if anyone is interested in how to set the Report Filter as the default filter:

                  1. I created the filters I need in Administration > Report Filters and after creating them, made Rebuild and made Rebuild Report Filters (screenshot 1).
                  2. As a result ​/var/www/html/your_instance_name/custom/Espo/Custom/Resources/metadata/clientDefs/Account.json​ had the following form:
                  Code:
                  {
                      "filterList": [
                          "__APPEND__",
                          {
                              "isReportFilter": true,
                              "name": "reportFilter64668835517b215b5"
                          },
                          {
                              "isReportFilter": true,
                              "name": "reportFilter646686b2ed452e575"
                          }
                      ]
                  }​

                  3. Note that the name of your filter will be different from what you see in the UI. However, it is easy to find by ID. Actually in our Account.json the name of our filter consists of reportFilter and ID. I put the following in /var/www/html/your_instance_name/custom/Espo/Custom/Resources/metadata/clientDefs/Account.json​:
                  Code:
                  {
                      "defaultFilterData": {
                          "primary": "reportFilter64668835517b215b5"
                      }
                  }​

                  4. Step 3 made it impossible to select another one of my custom Report Filters that I needed. Therefore, I made Rebuild and made Rebuild Report Filters again, although I could insert immediately (both options are suitable):
                  Code:
                  {
                      "defaultFilterData": {
                          "primary": "reportFilter64668835517b215b5"
                      },
                      "filterList": [
                          "__APPEND__",
                          {
                              "isReportFilter": true,
                              "name": "reportFilter64668835517b215b5"
                          },
                          {
                              "isReportFilter": true,
                              "name": "reportFilter646686b2ed452e575"
                          }
                      ]
                  }​

                  5. Final result on screenshot 2.
                  Attached Files
                  Last edited by victor; 05-19-2023, 01:12 PM.

                  Comment

                  • Ashif Malayil
                    Senior Member
                    • Dec 2023
                    • 171

                    #15
                    Hello victor,

                    When I am creating an Opportunity from an Account, only the related Contacts are shown (see Screenshot 1). Similarly, I have a custom entity called Dealer. When I create an Opportunity there, the Contact-related filter should also apply, but instead, it is showing all contacts. Could you please help me implement this filter for the custom entity I created?

                    Comment

                  Working...