Announcement

Collapse
No announcement yet.

getSelectFilters Not Working for Filter Linked Field Values

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

  • getSelectFilters Not Working for Filter Linked Field Values

    Hey All!

    I'm having trouble getting getSelectFilters to work for a custom Entity, in the following scenario;
    - EspoCRM 5.8.2
    - Out-of-Box Account Entity & Relationships
    - Out of Box Case Entity & Relationships
    - Custom Entity named "Asset" with Many-to-One relationship for Accounts and Many-to-Many relationship with Cases

    As you might imagine, I'm trying to create a Case with an Account, and filter the Asset list based on the Account. It simply does not seem to work.

    Aside from not working, I'm having a hard time trying to work out how to debug/troubleshoot.

    Following a number of posts for reference;
    - https://forum.espocrm.com/forum/deve...sed-on-account
    - https://forum.espocrm.com/forum/deve...ity-link-field

    I have the following in ./client/custom/src/views/case/fields/assets.js (created new file):
    Code:
    Espo.define('custom:views/case/fields/assets', 'views/fields/link-multiple', function (Dep) {
    
        return Dep.extend({
    
            getSelectFilters: function () {
                if (this.model.get('accountId')) {
                    return {
                        'account': {
                            type: 'equals',
                            attribute: 'accountId',
                            value: this.model.get('accountId'),
                            data: {
                                type: 'is',
                                nameValue: this.model.get('accountName')
                            }
                        }
                    };
                }
            },
    
            getCreateAttributes: function () {
                if (this.model.get('accountId')) {
                    return {
                        accountId: this.model.get('accountId'),
                        accountName: this.model.get('accountName')
                    }
                }
            }
    
        });
    
    
    });
    [/CODE]

    And the following in ./custom/Espo/Custom/Resources/metadata/entityDefs/Case.json (edited existing file)
    Code:
            "assets": {
                "type": "linkMultiple",
                "view": "custom:views/case/fields/assets",
                "orderBy": "name",
                "layoutDetailDisabled": false,
                "layoutMassUpdateDisabled": false,
                "importDisabled": false,
                "noLoad": false,
                "isCustom": true
            }
    Is there something obvious I'm missing here? Is anyone able to point me in the direction of how or where to troubleshoot?

    I'm new to EspoCRM, however, I noted through Apache and Wireshark traces that Case.json and assets.js never pass through the web server to the client. Are these only used on server-side? If so, is there an easy way to trace the inner workings of these functions

    Regards,

    Michael

  • #2
    Recently I'm interested in "Automated" Filter the List (small) view (Popup sidebar) too. Look like you haven't manage to fix it yet.
    I found another thread that may be helpful: https://forum.espocrm.com/forum/deve...r-in-list-view

    Good luck. I await goods new because I want to create a filter as well, save me having to manually filter each time.

    Comment

    Working...
    X