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]
And the following in ./custom/Espo/Custom/Resources/metadata/entityDefs/Case.json (edited existing file)
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
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') } } } }); });
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 }
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
Comment