Default Filters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JoeRoot
    Junior Member
    • Jan 2019
    • 12

    Default Filters

    Hi,

    How can I create global filters? For instance, in opportunities, all users have access to the "Open" and "Won" filters. Also, is there any way of setting a default filter that is not "All"?
  • item
    Active Community Member
    • Mar 2017
    • 1476

    #2
    Hi,
    look for folder "SelectManagers"
    and for : Resources/clientDefs/

    sample :

    PHP Code:
    <?php
    
    namespace Espo\Custom\SelectManagers;
    
    class Contact extends \Espo\Modules\Crm\SelectManagers\Contact
    {
    
        protected function boolFilterIsActive(&$result)
        {
            $result['whereClause'][] = array(
                                             'isActive' => true
                                             );
        }
    }
    PHP Code:
    {
        "boolFilterList": [
            "onlyMy",
            "isActive"
        ]
    } 
    
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • khopper
      Senior Member
      • Sep 2017
      • 329

      #3
      It would be great if this could be done via the GUI.
      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

      Comment

      • rodrigocoelho
        Active Community Member
        • Jun 2016
        • 296

        #4
        Originally posted by khopper
        It would be great if this could be done via the GUI.
        https://forum.espocrm.com/forum/feat...der-any-entity
        I asked for the same thing in other post. My problem is not related to speed, but for helping to choose the correct linked object when typing (autocomplete), it is showing ALL thousands of options, and I would like to have only the "not archived" ones as options.

        Let's hope yuri can think on a solution for the next versions. I trust him!

        Comment

        • yuri
          Member
          • Mar 2014
          • 8453

          #5
          Reports has an ability to be used as a filter https://github.com/espocrm/documenta...sed-on-reports
          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

          • rodrigocoelho
            Active Community Member
            • Jun 2016
            • 296

            #6
            Originally posted by yurikuzn
            Reports has an ability to be used as a filter https://github.com/espocrm/documenta...sed-on-reports
            We are talking about DEFAULT filters. Like ALWAYS filtering Archived ones......

            Comment

            • rodrigocoelho
              Active Community Member
              • Jun 2016
              • 296

              #7
              Originally posted by rodrigocoelho

              We are talking about DEFAULT filters. Like ALWAYS filtering Archived ones......
              Any clue of what we should change to achieve this? Any Nameselector?

              Thanks

              Comment

              • yuri
                Member
                • Mar 2014
                • 8453

                #8
                This logic can be defined in SelectManager class.
                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

                • rodrigocoelho
                  Active Community Member
                  • Jun 2016
                  • 296

                  #9
                  Originally posted by yurikuzn
                  This logic can be defined in SelectManager class.
                  I see it only for some entities.

                  Click image for larger version

Name:	Capturar.JPG
Views:	1306
Size:	65.5 KB
ID:	47070

                  Comment

                  • khopper
                    Senior Member
                    • Sep 2017
                    • 329

                    #10
                    I see the exact same thing that rodrigocoelho is seeing in this directory.
                    yurikuzn - Perhaps we are not on the same page of understanding.

                    Default Filters for the list view of an entity upon logging in, unless cleared or changed.

                    See Screen shot - I would like this displayed every time I log in by default. (The filter)

                    Comment

                    • yuri
                      Member
                      • Mar 2014
                      • 8453

                      #11
                      custom/Espo/Custom/Resources/metadata/clientDefs/YourEntityType.json


                      Primary filter. 'active' is the name of primary filter (dropdown on the left).

                      Code:
                      {
                          "defaultFilterData": {
                                 "primary": "active"
                           }
                      }
                      Field filter.
                      Code:
                      {
                          "defaultFilterData": {
                                 "advanced": {
                                      "orderDate": {
                                              "type": "lastSevenDays"
                                       }
                                  }
                           }
                      }
                      Last edited by yuri; 03-23-2019, 06:12 AM.
                      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

                        #12
                        What would the syntax be for the last 45 days in the filter?
                        "Last X Days" - 45
                        Also - Where did "Clear Local Cache" go? - (to get the default filter back I have to clear the browser history)
                        Last edited by khopper; 03-26-2019, 01:11 PM.

                        Comment

                        • yuri
                          Member
                          • Mar 2014
                          • 8453

                          #13
                          Code:
                          "type": "lastXDays",
                          "number": -45,
                          "value": -45
                          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

                            #14
                            Putting the negative did not work as expected - just FYI for others
                            Also - Where did "Clear Local Cache" go? - (to get the default filter back I have to clear the browser history)

                            This is what did work:
                            Code:
                            "defaultFilterData": {
                                       "advanced": {
                                            "orderdate": {
                                                    "type": "lastXDays",
                                                    "number": 45,
                                                    "value": 45
                                             }
                                        }
                                 }

                            Comment

                            • rodrigocoelho
                              Active Community Member
                              • Jun 2016
                              • 296

                              #15
                              Originally posted by yurikuzn
                              custom/Espo/Custom/Resources/metadata/clientDefs/YourEntityType.json


                              Primary filter. 'active' is the name of primary filter (dropdown on the left).

                              Code:
                              {
                              "defaultFilterData": {
                              "primary": "active"
                              }
                              }
                              Field filter.
                              Code:
                              {
                              "defaultFilterData": {
                              "advanced": {
                              "orderDate": {
                              "type": "lastSevenDays"
                              }
                              }
                              }
                              }
                              Hi Yuri, does it would work for INSTANT SEARCH on that view as well?

                              Thanks

                              Comment

                              Working...