Announcement

Collapse
No announcement yet.

Default Filters

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

  • 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"?

  • #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"
        
    ]

    Comment


    • #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


      • #4
        Originally posted by khopper View Post
        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


        • #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


          • #6
            Originally posted by yurikuzn View Post
            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


            • #7
              Originally posted by rodrigocoelho View Post

              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


              • #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


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

                  Click image for larger version

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

                  Comment


                  • #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


                    • #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


                      • #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


                        • #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


                          • #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


                            • #15
                              Originally posted by yurikuzn View Post
                              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...
                              X