Ability to adjust default filter under any entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • victor
    commented on 's reply
    A similar request was considered on the forum. You may find it useful: https://forum.espocrm.com/forum/deve...current-record.

  • Ashif Malayil
    replied
    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?

    Leave a comment:


  • victor
    replied
    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.

    Leave a comment:


  • rabii
    commented on 's reply
    i see
    thanks

  • lazovic
    replied
    rabii,

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

    Leave a comment:


  • rabii
    commented on 's reply
    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
    replied
    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.

    Leave a comment:


  • rabii
    commented on 's reply
    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.

  • victor
    commented on 's reply
    rabii, I think, this is answer https://forum.espocrm.com/forum/gene...7196#post47196

  • rabii
    commented on 's reply
    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
    replied
    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.

    Leave a comment:


  • beeline
    replied
    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.

    Leave a comment:


  • khopper
    replied
    This would be a great Feature to be able to manage via the GUI! Currently Running Version 5.3.6

    Leave a comment:


  • khopper
    replied
    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.

    Leave a comment:


  • khopper
    commented on 's reply
    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.
Working...