Hello lads,
I'm looking for dev help regarding 2 functionalities:
1. Custom Print to PDF button in the top right (views/detail)
I have been trying to do this simple task by following both the documentation and ALL the threads here without any success. My button appears in the Detail view but unfortunately throws several different JS errors when clicked. I have tried to implement this by both custom handler and custom views.
The expected behavior after clicking on the custom button is to open the template modal selection and create the PDF document after template selection.
Other expected behavior would be to skip the template selection and directly open the generated PDF based on predefined templateId.
2. Custom dynamic search filters via getSelectFilters
I have been trying for 2 days to copy the same logic as in Accounts/Contacts/Opportunities/Quotes for dynamic filtering based on other fields.
/custom/Espo/Custom/Resources/metadata/clientDefs/Claim.json:
/client/custom/src/views/claim/fields/insurance-policy.js
Any help would be appreciated!
I'm looking for dev help regarding 2 functionalities:
1. Custom Print to PDF button in the top right (views/detail)
I have been trying to do this simple task by following both the documentation and ALL the threads here without any success. My button appears in the Detail view but unfortunately throws several different JS errors when clicked. I have tried to implement this by both custom handler and custom views.
The expected behavior after clicking on the custom button is to open the template modal selection and create the PDF document after template selection.
Other expected behavior would be to skip the template selection and directly open the generated PDF based on predefined templateId.
2. Custom dynamic search filters via getSelectFilters
I have been trying for 2 days to copy the same logic as in Accounts/Contacts/Opportunities/Quotes for dynamic filtering based on other fields.
/custom/Espo/Custom/Resources/metadata/clientDefs/Claim.json:
Code:
{ "controller": "controllers/record", "boolFilterList": [ "onlyMy" ], "iconClass": "far fa-money-bill-alt", "kanbanViewMode": false, "dynamicLogic": { "fields": { "insurancePolicy": { "view": "custom:views/claim/fields/insurance-policy" }, "claimChecklist": { "visible": { "conditionGroup": [ { "type": "equals", "attribute": "insuranceProductId", "data": { "field": "insuranceProduct", "values": { "insuranceProductName": "MTPL" } }, "value": "5fa28ab7221a524f5" } ] } } } } }
Code:
Espo.define('custom:views/claim/fields/insurance-policy', 'views/fields/link', function (Dep) { return Dep.extend({ setup: function () { Dep.prototype.setup.call(this); // some initialization }, getSelectFilters: function () { if (this.model.get('accountId')) { var nameHash = {}; nameHash[this.model.get('accountId')] = this.model.get('accountName'); return { 'account': { type: 'linkedWith', value: [this.model.get('accountId')], data: { type: 'anyOf', nameHash: nameHash, } } }; } }, getCreateAttributes: function () { if (this.model.get('accountId')) { return { accountId: this.model.get('accountId'), accountName: this.model.get('accountName') } } }, }); });
Comment