Hi,
I am trying to create a Print button in the detail view by following the instructions on the documentation link Buttons & Actions.
I was able to create the Definition and Handler Class and was able to show the button in the detail view on the top right corner. But I need help on how I can print the record if I click the button. Hoping that you could also help me on this.
This is the Definition that I appended in my CCashar.json file
This is the Handler that I created : my-print-car.js
Thanks
I am trying to create a Print button in the detail view by following the instructions on the documentation link Buttons & Actions.
I was able to create the Definition and Handler Class and was able to show the button in the detail view on the top right corner. But I need help on how I can print the record if I click the button. Hoping that you could also help me on this.
This is the Definition that I appended in my CCashar.json file
Code:
"menu": { "detail": { "buttons": [ "__APPEND__", { "label": "My Action", "name": "myAction", "action": "myAction", "style": "default", "acl": "edit", "aclScope": "Lead", "handler": "custom:my-print-car", "initFunction": "initMyAction", "actionFunction": "myAction", "checkVisibilityFunction": "isMyActionVisible" } ] } }
Code:
define('custom:my-print-car', ['action-handler'], (Dep) => { return class extends Dep { initMyAction() {} myAction(data, e) { this.view.disableMenuItem('myAction'); Espo.Ajax.getRequest('Lead/' + this.view.model.id) .then(response => { console.log(response); this.view.enableMenuItem('myAction'); }) .catch(() => this.view.enableMenuItem('myAction')); } isMyActionVisible() { return !['Converted', 'Dead', 'Recycled'].includes(this.view.model.get('status')); } } });
Thanks
Comment